简体   繁体   中英

Java Deflater Output

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]

Java中的Writer像对待String一样对待所有内容,因此您会看到\\r\\n\\0 ,它是DOS换行符序列,后跟字符串终止符。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM