List of usage examples for io.netty.buffer ByteBuf readShort
public abstract short readShort();
From source file:vazkii.quark.decoration.entity.EntityColoredItemFrame.java
License:Creative Commons License
@Override public void readSpawnData(ByteBuf additionalData) { updateFacingWithBoundingBox(EnumFacing.getHorizontal(additionalData.readShort())); }
From source file:vazkii.quark.decoration.entity.EntityFlatItemFrame.java
License:Creative Commons License
@Override public void readSpawnData(ByteBuf additionalData) { updateFacingWithBoundingBox(EnumFacing.getFront(additionalData.readShort())); }
From source file:websocketclient.WebSocketClientHandler.java
License:Apache License
public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception { Channel ch = ctx.channel();/* w w w . j a v a 2 s . c om*/ if (!handshaker.isHandshakeComplete()) { handshaker.finishHandshake(ch, (FullHttpResponse) msg); handshakeFuture.setSuccess(); System.err.println("?"); //binary // for (int i = 0; i < 10; i++) { // ByteBuf byteBuf =Unpooled.buffer(); // byteBuf.writeInt(3000008); // byteBuf.writeDouble(1001); // writeString("| hello world |",byteBuf); // byteBuf.writeFloat(888.05f); // sendBinary((short) 2001,byteBuf,ch); // } //text for (int i = 0; i < 10; i++) { sendText((short) 4001, "//////////////////////////////////", ch); } return; } WebSocketFrame frame = (WebSocketFrame) msg; if (frame instanceof PingWebSocketFrame) { ctx.channel().write(new PongWebSocketFrame(frame.content().retain())); return; } if (frame instanceof BinaryWebSocketFrame) { BinaryWebSocketFrame bw = (BinaryWebSocketFrame) frame; ByteBuf conBuf = bw.content(); int len = conBuf.readInt(); short cmdId = conBuf.readShort(); ByteBuf msgBuf = Unpooled.buffer(conBuf.readableBytes()); conBuf.readBytes(msgBuf); System.err.println("<<<<<<<protoId=" + cmdId + " "); } else { TextWebSocketFrame f = (TextWebSocketFrame) frame; WsTextForDefaultJsonDecoder dd = new WsTextForDefaultJsonDecoder(); StringMessage sf = dd.unPack(f.text()); System.err.println(f.text()); System.out.println("==" + sf.getId() + " " + sf.getContent()); } }