public IResponseState Parse(Header header, IEndianAwareReader reader) { // How many bytes will we read from the stream? var numBytes = reader.ReadInt32(); // Fill the byte array with bytes left from the previous read. // This is neccessary when reading chunks of data var writer = new IntrusiveByteArrayWriter(); writer.Insert(previousState.BytesLeft); // Read the bytes into the intrusive byte array reader.ReadBytes(numBytes, writer); if (writer.Length > 0) { if (header.IsMultipart) return ReadJournal(new InputStreamBytes(writer), false); else return ReadJournal(new InputStreamBytes(writer), true); } else return new ReadJournalResponseState(0, new List<Event>(), true, new byte[0]); }