Class ByteBufferUtil


  • public final class ByteBufferUtil
    extends java.lang.Object
    Utilities for interacting with ByteBuffers.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.nio.ByteBuffer fromFile​(java.io.File file)  
      static java.nio.ByteBuffer fromStream​(java.io.InputStream stream)  
      static java.nio.ByteBuffer rewind​(java.nio.ByteBuffer buffer)  
      static byte[] toBytes​(java.nio.ByteBuffer byteBuffer)  
      static void toFile​(java.nio.ByteBuffer buffer, java.io.File file)  
      static java.io.InputStream toStream​(java.nio.ByteBuffer buffer)  
      static void toStream​(java.nio.ByteBuffer byteBuffer, java.io.OutputStream os)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • fromFile

        @NonNull
        public static java.nio.ByteBuffer fromFile​(@NonNull
                                                   java.io.File file)
                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • toFile

        public static void toFile​(@NonNull
                                  java.nio.ByteBuffer buffer,
                                  @NonNull
                                  java.io.File file)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • toStream

        public static void toStream​(@NonNull
                                    java.nio.ByteBuffer byteBuffer,
                                    @NonNull
                                    java.io.OutputStream os)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • toBytes

        @NonNull
        public static byte[] toBytes​(@NonNull
                                     java.nio.ByteBuffer byteBuffer)
      • toStream

        @NonNull
        public static java.io.InputStream toStream​(@NonNull
                                                   java.nio.ByteBuffer buffer)
      • fromStream

        @NonNull
        public static java.nio.ByteBuffer fromStream​(@NonNull
                                                     java.io.InputStream stream)
                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • rewind

        public static java.nio.ByteBuffer rewind​(java.nio.ByteBuffer buffer)