Java ByteBuffer Write writeAllToChannel(List buffers, WritableByteChannel channel)

Here you can find the source of writeAllToChannel(List buffers, WritableByteChannel channel)

Description

write All To Channel

License

Apache License

Declaration

private static void writeAllToChannel(List<ByteBuffer> buffers, WritableByteChannel channel)
            throws IOException 

Method Source Code


//package com.java2s;
/*//from   www.jav  a2 s . c om
 * Copyright 2014 WANdisco
 *
 *  WANdisco licenses this file to you under the Apache License,
 *  version 2.0 (the "License"); you may not use this file except in compliance
 *  with the License. You may obtain a copy of the License at:
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 *  License for the specific language governing permissions and limitations
 *  under the License.
 */

import java.io.IOException;

import java.nio.ByteBuffer;

import java.nio.channels.WritableByteChannel;
import java.util.List;

public class Main {
    private static void writeAllToChannel(List<ByteBuffer> buffers, WritableByteChannel channel)
            throws IOException {
        for (ByteBuffer buffer : buffers) {
            channel.write(buffer);
        }
    }
}

Related

  1. write(WritableByteChannel out, ByteBuffer buffer)
  2. write(WritableByteChannel socketChannel, SSLEngine engine, ByteBuffer plainOut, ByteBuffer cypherOut)
  3. writeAll(ByteBuffer buf, WritableByteChannel channel)
  4. writeAll(ByteChannel channel, ByteBuffer buffer)
  5. writeAll(GatheringByteChannel ch, ByteBuffer... bbs)
  6. writeBE(ByteBuffer bb, int elementWidth, long value)
  7. writeBER32(ByteBuffer buffer, int value)
  8. writeBigInteger(ByteBuffer bb, BigInteger bigInteger, int length)
  9. writeBlock(String fileName, long startOffset, ByteBuffer buffer, Logger log)