Java ByteBuffer Write write(MappedByteBuffer buffer, int pos, String asciString)

Here you can find the source of write(MappedByteBuffer buffer, int pos, String asciString)

Description

write

License

Apache License

Declaration

public static void write(MappedByteBuffer buffer, int pos, String asciString) 

Method Source Code

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

import java.nio.MappedByteBuffer;

public class Main {
    public static void write(MappedByteBuffer buffer, int pos, String asciString) {
        byte[] bytes = asciString.getBytes();
        for (int i = 0; i < bytes.length; ++i) {
            buffer.put(pos + i, bytes[i]);
        }/*  w  w w.j  a v a2 s  .  c  om*/
    }

    public static void getBytes(MappedByteBuffer buffer, int pos, byte[] target) {
        for (int i = 0; i < target.length; ++i) {
            target[i] = buffer.get(pos + i);
        }
    }
}

Related

  1. write(ByteBuffer bb, int elementWidth, long value)
  2. write(ByteBuffer data, String filename, boolean append)
  3. write(final byte[] array, final int offset, final int end, final ByteBuffer outBB)
  4. write(GatheringByteChannel out, ByteBuffer[] buffers, int offset, int length)
  5. write(SocketChannel channel, ByteBuffer b, PrimitiveIterator.OfInt iterator)
  6. write(SocketChannel p_channel, SSLEngine p_sslEngine, ByteBuffer p_outAppBuf, ByteBuffer p_outNetBuf)
  7. write(WritableByteChannel channel, ByteBuffer buffer, byte[] data)
  8. write(WritableByteChannel channel, ByteBuffer[] srcs)