Code example for WritableByteChannel

Methods: write

0
  public void writeInt(WritableByteChannel out, int intValue) throws IOException
  { 
    final ByteBuffer buffer = ByteBuffer.allocate(4);
    buffer.putInt(intValue);
    buffer.flip();
    out.write(buffer);
  } 
 
  public int readInt(InputStream in) throws IOException
  { 
    byte[] intBytes = new byte[4];
 
    ByteStreams.readFully(in, intBytes);
 
    return ByteBuffer.wrap(intBytes).getInt();
  } 
 
  public void writeInts(OutputStream out, int[] ints) throws IOException
  { 
    writeInt(out, ints.length);
Connect your IDE to all the code out there  Get Codota for Java