Java ByteBuffer Read readAsciiString(MappedByteBuffer buffer, int pos, int length)

Here you can find the source of readAsciiString(MappedByteBuffer buffer, int pos, int length)

Description

read Ascii String

License

Apache License

Declaration

public static String readAsciiString(MappedByteBuffer buffer, int pos, int length) 

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 String readAsciiString(MappedByteBuffer buffer, int pos, int length) {
        byte[] target = new byte[length];
        getBytes(buffer, pos, target);/*from   ww  w  . ja  v a2  s .c  om*/
        return new String(target);
    }

    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. read(SocketChannel p_channel, SSLEngine p_sslEngine, ByteBuffer p_inAppBuf, ByteBuffer p_inNetBuf)
  2. readableBytes(ByteBuffer buffer)
  3. readAlexString(ByteBuffer buffer)
  4. readAllLeftBytes(ByteBuffer buffer)
  5. readASCII(ByteBuffer buffer)
  6. readBE(ByteBuffer bb, int elementWidth)
  7. readBoolean(ByteBuffer buff)
  8. readBooleanArray(ByteBuffer in)
  9. readBuf(ByteBuffer buffer)