Actually I broke BlockEncoder, but now it works.

2.x-1.16
szymon 2020-08-02 21:56:19 +02:00
parent a8b8e92187
commit 84cc3fdbfc
3 changed files with 15 additions and 4 deletions

View File

@ -263,6 +263,17 @@ public class BZip2OutputStream extends OutputStream
return this == o;
}
/**
* Close the stream if the client has been sloppy about it.
*/
@Override
protected void finalize() throws Throwable
{
close();
super.finalize();
}
/**
* Create a {@link BZip2EncoderExecutorService} that can be shared between
* several {@link BZip2OutputStream}:s to spread the bzip2 encoding work

View File

@ -179,9 +179,9 @@ final class BlockEncoder
{
byte[] res = m_scratchpad.m_sequenceMap;
byte index = 0;
for (int i : symbols)
for (byte i : symbols)
{
res[symbols[i] & 0xFF] = index++;
res[i & 0xFF] = index++;
}
return res;
}
@ -754,7 +754,7 @@ final class BlockEncoder
private void writeBlockHeader(final int blockChecksum, int bwFirstPointer, boolean[] seenDifferentBytes, MTFAndRLEResult mtfrle, HuffmanTreesAndUsage htau) throws IOException
{
// Block magic
for (int b : BLOCK_MAGIC) {
for (byte b : BLOCK_MAGIC) {
m_out.writeBitsLittleEndian(b & 0xFF, 8);
}
// Checksum

View File

@ -307,7 +307,7 @@ final class BlockOutputStream extends OutputStream
@Override
public void write(final byte[] data) throws IOException
{
for (int datum : data) {
for (byte datum : data) {
write(datum & 0xFF);
}
}