Class BufferUtil


  • public class BufferUtil
    extends Object
    • Method Detail

      • toArray

        public static byte[] toArray​(ByteBuffer buffer)
        Convert a ByteBuffer to a byte array.
        Parameters:
        buffer - The buffer to convert in flush mode. The buffer is not altered.
        Returns:
        An array of bytes duplicated from the buffer.
      • copy

        public static ByteBuffer copy​(ByteBuffer buffer)
        Copy of a ByteBuffer into a heap buffer
        Parameters:
        buffer - The buffer to copy.
        Returns:
        A copy of the provided buffer.
      • isPlainText

        public static boolean isPlainText​(ByteBuffer originalBuffer)
        Very rudimentary method to check if the provided ByteBuffer contains text.
        Returns:
        true if the buffer contains text, false otherwise.