In Java, I have created a class called Writer that extends
It is initialized with the followin, where bos is a ByteOutputStream:
this.internalWriter = new Writer(bos, Manager.defaultSize, new Deflater(Deflater.DEFAULT_COMPRESSION, true));
When later I call
bos.writeTo(System.out);
Everything seems to work okay. But I noticed if I check out what bos is actually outputting by converting it to a byte array, it is always outputting these three bytes at the end of anything, and I don’t know why that would occur…any ideas? This is causing problems in my compression algorithm…
Those confusing three bytes are as follows:
[-27,2,0]
Writers in java treat everything like aStringso what you’re seeing would be\r\n\0, which is a DOS newline sequence, followed by a string terminator.