private ByteBuffer readBlock(ByteBuffer buffer, long size) { if (size == 0) { return null; } if (size > buffer.remaining()) { String err = String.format("Truncated data, expected %,d byte(s), but only %,d byte(s) remain",size,buffer.remaining()); throw new MuxException(err); } if (size > Integer.MAX_VALUE) { String err = String.format("[Int-Sane!] Buffer size %,d is too large to be supported (max allowed is %,d)",size,Integer.MAX_VALUE); throw new MuxException(err); } ByteBuffer ret = ByteBuffer.allocateDirect((int)size); BufferUtil.put(buffer,ret); BufferUtil.flipToFlush(ret,0); return ret; }
private ByteBuffer readBlock(ByteBuffer buffer, long size) { if (size == 0) { return null; } if (size > buffer.remaining()) { String err = String.format("Truncated data, expected %,d byte(s), but only %,d byte(s) remain",size,buffer.remaining()); throw new MuxException(err); } if (size > Integer.MAX_VALUE) { String err = String.format("[Int-Sane!] Buffer size %,d is too large to be supported (max allowed is %,d)",size,Integer.MAX_VALUE); throw new MuxException(err); } ByteBuffer ret = ByteBuffer.allocateDirect((int)size); BufferUtil.put(buffer,ret); BufferUtil.flipToFlush(ret,0); return ret; }
throw new MuxException("Not a valid request");
throw new MuxException("Not a valid request");
events.onMuxException(new MuxException(t));
events.onMuxException(new MuxException(t));
throw new MuxException(err); throw new MuxException(t);
throw new MuxException(err); throw new MuxException(t);