Here you can find the source of readBytesNoLength(ByteBuffer logBuf, int size)
public static byte[] readBytesNoLength(ByteBuffer logBuf, int size)
//package com.java2s; /*-//from ww w .j a v a 2s .co m * See the file LICENSE for redistribution information. * * Copyright (c) 2002-2010 Oracle. All rights reserved. * */ import java.nio.ByteBuffer; public class Main { private static final boolean DEBUG = false; public static final byte[] ZERO_LENGTH_BYTE_ARRAY = new byte[0]; /** * Read a byte array from the log. The size is not stored. */ public static byte[] readBytesNoLength(ByteBuffer logBuf, int size) { if (DEBUG) { System.out.println("pos = " + logBuf.position() + " byteArray is " + size + " on read"); } if (size == 0) { return ZERO_LENGTH_BYTE_ARRAY; } byte[] b = new byte[size]; logBuf.get(b); // read it out return b; } }