use of com.android.zipflinger.Location in project bundletool by google.
the class ZipReader method transferTo.
/**
* Copies the bytes of the payload of a zip entry to the given {@link ZipWriter}.
*
* <p>The copy happens using {@link FileChannel#transferTo} which takes advantage of filesystem
* cache, making it a very I/O efficient way to copy data across files.
*/
public void transferTo(ZipWriter zipWriter, String entryName) {
Entry entry = getEntry(entryName).orElseThrow(() -> new EntryNotFoundException(zipMap.getFile(), entryName));
Location payloadLocation = entry.getPayloadLocation();
try {
zipWriter.transferFrom(fileChannel, payloadLocation.first, payloadLocation.size());
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
Aggregations