Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void serializeRequest(org.jboss.netty.channel.Channel channel, org.jboss.netty.buffer.ChannelBuffer buffer, RequestType type, RequestContext ctx, Serializer payload) throws java.io.IOException
        public virtual void SerializeRequest(Channel channel, ChannelBuffer buffer, RequestType type, RequestContext ctx, Serializer payload)
        {
            buffer.clear();
            ChunkingChannelBuffer chunkingBuffer = new ChunkingChannelBuffer(buffer, channel, _chunkSize, _internalProtocolVersion, _applicationProtocolVersion);

            chunkingBuffer.WriteByte(type.Id());
            WriteContext(ctx, chunkingBuffer);
            payload.Write(chunkingBuffer);
            chunkingBuffer.Done();
        }
Пример #2
0
 protected internal virtual void WriteFailureResponse(Exception exception, ChunkingChannelBuffer buffer)
 {
     try
     {
         MemoryStream       bytes = new MemoryStream();
         ObjectOutputStream @out  = new ObjectOutputStream(bytes);
         @out.writeObject(exception);
         @out.close();
         buffer.WriteBytes(bytes.toByteArray());
         buffer.Done();
     }
     catch (IOException)
     {
         _msgLog.warn("Couldn't send cause of error to client", exception);
     }
 }