@Test void testByteBufferToByteArray() { byte[] array = "halleluja".getBytes(StandardCharsets.UTF_8); ByteBuffer wrap = ByteBuffer.wrap(array); byte[] unwrapped = Utils.toByteArray(wrap); assertThat(unwrapped, is(array)); }
public static byte[] toByteArray(ByteBuffer byteBuffer) { byte[] buff = new byte[byteBuffer.remaining()]; return toByteArray(byteBuffer, buff, 0); }
Utils { public static byte[] toByteArray(ByteBuffer byteBuffer) { byte[] buff = new byte[byteBuffer.remaining()]; return toByteArray(byteBuffer, buff, 0); } }
Utils { public static byte[] toByteArray(ByteBuffer byteBuffer) { byte[] buff = new byte[byteBuffer.remaining()]; return toByteArray(byteBuffer, buff, 0); } private  Utils(); }
Utils { public static byte[] toByteArray(ByteBuffer byteBuffer) { byte[] buff = new byte[byteBuffer.remaining()]; return toByteArray(byteBuffer, buff, 0); } private  Utils(); static List<String> tokenize(char separator, String quoteChars, boolean includeEmptyTokens, String text); static String unwrap(String str); static void write(ByteBuffer byteBuffer, OutputStream out); static byte[] toByteArray(ByteBuffer byteBuffer); }
Utils { public static byte[] toByteArray(ByteBuffer byteBuffer) { byte[] buff = new byte[byteBuffer.remaining()]; return toByteArray(byteBuffer, buff, 0); } private  Utils(); static List<String> tokenize(char separator, String quoteChars, boolean includeEmptyTokens, String text); static String unwrap(String str); static void write(ByteBuffer byteBuffer, OutputStream out); static byte[] toByteArray(ByteBuffer byteBuffer);  }