Java ByteBuffer Write write(WritableByteChannel out, ByteBuffer buffer)

Here you can find the source of write(WritableByteChannel out, ByteBuffer buffer)

Description

write

License

Open Source License

Declaration

public static int write(WritableByteChannel out, ByteBuffer buffer) throws IOException 

Method Source Code


//package com.java2s;
import java.io.IOException;
import java.nio.ByteBuffer;

import java.nio.channels.WritableByteChannel;

public class Main {
    public static int write(WritableByteChannel out, ByteBuffer buffer) throws IOException {
        int bytesWritten = 0;
        while (buffer.hasRemaining()) {
            bytesWritten += out.write(buffer);
        }/*from ww w.  j a v a  2 s  .  c o  m*/

        return bytesWritten;
    }
}

Related

  1. write(SocketChannel channel, ByteBuffer b, PrimitiveIterator.OfInt iterator)
  2. write(SocketChannel p_channel, SSLEngine p_sslEngine, ByteBuffer p_outAppBuf, ByteBuffer p_outNetBuf)
  3. write(WritableByteChannel channel, ByteBuffer buffer, byte[] data)
  4. write(WritableByteChannel channel, ByteBuffer[] srcs)
  5. write(WritableByteChannel channel, ByteBuffer[] srcs, int offset, int length)
  6. write(WritableByteChannel socketChannel, SSLEngine engine, ByteBuffer plainOut, ByteBuffer cypherOut)
  7. writeAll(ByteBuffer buf, WritableByteChannel channel)
  8. writeAll(ByteChannel channel, ByteBuffer buffer)
  9. writeAll(GatheringByteChannel ch, ByteBuffer... bbs)