public static StreamMessage deserialize(ReadableByteChannel in, int version, StreamSession session) throws IOException { ByteBuffer buff = ByteBuffer.allocate(1); int readBytes = in.read(buff); if (readBytes > 0) { buff.flip(); Type type = Type.get(buff.get()); return type.inSerializer.deserialize(in, version, session); } else if (readBytes == 0) { // input socket buffer was not filled yet return null; } else { // possibly socket gets closed throw new SocketException("End-of-stream reached"); } }
public static StreamMessage deserialize(ReadableByteChannel in, int version, StreamSession session) throws IOException { ByteBuffer buff = ByteBuffer.allocate(1); int readBytes = in.read(buff); if (readBytes > 0) { buff.flip(); Type type = Type.get(buff.get()); return type.inSerializer.deserialize(in, version, session); } else if (readBytes == 0) { // input socket buffer was not filled yet return null; } else { // possibly socket gets closed throw new SocketException("End-of-stream reached"); } }
public static StreamMessage deserialize(ReadableByteChannel in, int version, StreamSession session) throws IOException { ByteBuffer buff = ByteBuffer.allocate(1); int readBytes = in.read(buff); if (readBytes > 0) { buff.flip(); Type type = Type.get(buff.get()); return type.inSerializer.deserialize(in, version, session); } else if (readBytes == 0) { // input socket buffer was not filled yet return null; } else { // possibly socket gets closed throw new SocketException("End-of-stream reached"); } }
public static StreamMessage deserialize(ReadableByteChannel in, int version, StreamSession session) throws IOException { ByteBuffer buff = ByteBuffer.allocate(1); int readBytes = in.read(buff); if (readBytes > 0) { buff.flip(); Type type = Type.get(buff.get()); return type.inSerializer.deserialize(in, version, session); } else if (readBytes == 0) { // input socket buffer was not filled yet return null; } else { // possibly socket gets closed throw new SocketException("End-of-stream reached"); } }