dispose input source right after buffering

This commit is contained in:
REAndroid 2023-04-29 19:31:03 +02:00
parent ee03ff9eaa
commit 1525ba586a

View File

@ -59,7 +59,7 @@ class OutputSource {
} }
private EntryBuffer writeBuffer(BufferFileInput input, BufferFileOutput output) throws IOException { private EntryBuffer writeBuffer(BufferFileInput input, BufferFileOutput output) throws IOException {
long offset = output.position(); long offset = output.position();
onWriteBuffer(output); writeBufferFile(output);
long length = output.position() - offset; long length = output.position() - offset;
return new EntryBuffer(input, offset, length); return new EntryBuffer(input, offset, length);
} }
@ -96,7 +96,7 @@ class OutputSource {
} }
dataDescriptor.writeBytes(apkWriter.getOutputStream()); dataDescriptor.writeBytes(apkWriter.getOutputStream());
} }
void onWriteBuffer(BufferFileOutput output) throws IOException { private void writeBufferFile(BufferFileOutput output) throws IOException {
LocalFileHeader lfh = getLocalFileHeader(); LocalFileHeader lfh = getLocalFileHeader();
InputSource inputSource = getInputSource(); InputSource inputSource = getInputSource();
@ -130,6 +130,8 @@ class OutputSource {
lfh.setMethod(ZipEntry.STORED); lfh.setMethod(ZipEntry.STORED);
lfh.setCrc(rawCounter.getCrc()); lfh.setCrc(rawCounter.getCrc());
} }
inputSource.disposeInputSource();
} }
InputSource getInputSource() { InputSource getInputSource() {