1
我正在使用netty,並且必須解析ChannelBufferInputStream中的二進制數據。下面是我使用的代碼:如何使用InflaterInputStream封裝netty的ChannelBufferInputStream以擴充數據?
ins.skipBytes(14); // skip 14 bytes header
byte[] b = new byte[195]; // note that 195 is the length of data after inflation
(new InflaterInputStream(ins)).read(b, 0, 195);
可正常工作,但它設置在後195個字節的ChannelBufferInputStream的標誌。不用說,標記應該少於195個字節後設置。
是否有可能得到否。從輸入流中讀取'實際'字節,以便我可以自己設置標記?或者還有其他一些方法來誇大Netty中的ChannelBuffer數據嗎?