Package org.jboss.netty.buffer

Examples of org.jboss.netty.buffer.ChannelBuffer.writeByte()


 
 
  @Override
  public void sslDenied() {
    ChannelBuffer buffer = ChannelBuffers.directBuffer(1);
    buffer.writeByte('N');
    Channels.write(this.ctx, this.message.getFuture(), buffer, this.message.getRemoteAddress());   
  }
 
  private void sendErrorResponse(Throwable t) throws IOException {
    trace(t.getMessage());
View Full Code Here


    this.outBuffer = null;
    this.dataOut = null;
   
    // now build the wire contents.
    ChannelBuffer buffer = ChannelBuffers.directBuffer(len+5);
    buffer.writeByte((byte)this.messageType);
    buffer.writeInt(len+4);
    buffer.writeBytes(buff);
    Channels.write(this.ctx, this.message.getFuture(), buffer, this.message.getRemoteAddress());
  }
View Full Code Here

            } else if(frame instanceof Pong) {
                opcode = OPCODE_PONG;
            } else {
                opcode = frame.isText() ? OPCODE_TEXT : OPCODE_BINARY;
            }
            encoded.writeByte(0x80 | opcode);

            int length = data.readableBytes();
            if (length < 126) {
                encoded.writeByte(length);
            } else if (length < 65535) {
View Full Code Here

            }
            encoded.writeByte(0x80 | opcode);

            int length = data.readableBytes();
            if (length < 126) {
                encoded.writeByte(length);
            } else if (length < 65535) {
                encoded.writeByte(126);
                encoded.writeShort(length);
            } else {
                encoded.writeByte(127);
View Full Code Here

            int length = data.readableBytes();
            if (length < 126) {
                encoded.writeByte(length);
            } else if (length < 65535) {
                encoded.writeByte(126);
                encoded.writeShort(length);
            } else {
                encoded.writeByte(127);
                encoded.writeInt(length);
            }
View Full Code Here

                encoded.writeByte(length);
            } else if (length < 65535) {
                encoded.writeByte(126);
                encoded.writeShort(length);
            } else {
                encoded.writeByte(127);
                encoded.writeInt(length);
            }

            encoded.writeBytes(data, data.readerIndex(), data.readableBytes());
            encoded = encoded.slice(0, encoded.writerIndex());
View Full Code Here

  @Override
  protected Object encode(ChannelHandlerContext ctx, Channel channel, Object message) throws Exception
  {
    Message m = (Message) message;
    ChannelBuffer buffer = buffer(m.getMessage().length() + 2);
    buffer.writeByte(m.getCode());
    buffer.writeBytes(encoder.encode(CharBuffer.wrap(m.getMessage())));
    buffer.writeByte((byte) 0);
    // System.out.println("encode " + buffer.toString("UTF-8"));
    return buffer;
  }
View Full Code Here

  {
    Message m = (Message) message;
    ChannelBuffer buffer = buffer(m.getMessage().length() + 2);
    buffer.writeByte(m.getCode());
    buffer.writeBytes(encoder.encode(CharBuffer.wrap(m.getMessage())));
    buffer.writeByte((byte) 0);
    // System.out.println("encode " + buffer.toString("UTF-8"));
    return buffer;
  }

}
View Full Code Here

  void timedOut(ChannelHandlerContext ctx)
  {
      Constants.ahessianLogger.info("write timed out -> send empty buffer heartbeat");
    ChannelFuture future = Channels.future(_ctx.getChannel());
    ChannelBuffer b = ChannelBuffers.buffer(1);
    b.writeByte(0);
        _ctx.sendDownstream(new DownstreamMessageEvent(_ctx.getChannel(), future, b, _ctx.getChannel().getRemoteAddress()));
  }
 
    public void writeRequested(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
      ping();
View Full Code Here

        resultSize += causeMessage.length;
      }
    }

    ChannelBuffer result = ChannelBuffers.buffer(BinaryProtocol.BYTE_ORDER, resultSize);
    result.writeByte(_errorCode);
    result.writeInt(resultSize - 1 - 4);
    result.writeShort(classLen);
    result.writeBytes(causeClass, 0, classLen);
    result.writeShort(messageLen);
    if (messageLen > 0)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.