I'm trying to set inflater.Position by calling the code below:
Stream data = Compress(buffer); // data: length=12, position=12
//inflater: length=0, position=12
InflaterInputStream inflater = new InflaterInputStream(data);
inflater.IsStreamOwner = false;
// move forward:
inflater.Dispose();
data.Position = 0;
inflater = new InflaterInputStream(data); // inflater.position=0
inflater.IsStreamOwner = false;
byte[] buff = new byte[newPos - Position];
while(newPos > Position)
int count = inflater.Read(buff, 0, buff.Length); //inflater.position=12
Right now, when I try to move forward, the Position always stays at its original value. Is it because whatever length I put in Read method, the method always reads the entire stream, thus position = end of stream? How may I set inflater.Position?
Follow up: Why is inflater has a length of 0? Does it have anything to do with CanWrite property being false?