public IResponseState Parse(Header header, IEndianAwareReader reader)
 {
     var success = reader.ReadIntAsBool();
     var journalSize = new Offset(reader.ReadInt32());
     return new CommitResponseState(success, journalSize);
 }
 public IResponseState Parse(Header header, IEndianAwareReader reader)
 {
     var journalSize = new Offset(reader.ReadInt32());
     var transactionUID = new TransactionUID(reader.ReadInt32());
     return new NewTransactionResponseState(journalSize, transactionUID);
 }
        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]);
        }
 public IResponseState Parse(Header header, IEndianAwareReader reader)
 {
     var errorId = reader.ReadInt32();
     throw new EverstoreException(ErrorToString(errorId));
 }