Class ReadWriteIOUtils


  • public class ReadWriteIOUtils
    extends java.lang.Object
    ConverterUtils is a utility class. It provides conversion between normal datatype and byte array.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean checkIfMagicString​(java.io.InputStream inputStream)
      to check whether the inputStream is reach the magic string this method doesn't change the position of the inputStream
      static boolean checkIfMagicString​(java.nio.ByteBuffer byteBuffer)
      to check whether the byte buffer is reach the magic string this method doesn't change the position of the byte buffer
      static java.nio.ByteBuffer clone​(java.nio.ByteBuffer original)  
      static java.nio.ByteBuffer getByteBuffer​(boolean i)  
      static java.nio.ByteBuffer getByteBuffer​(double d)  
      static java.nio.ByteBuffer getByteBuffer​(float f)  
      static java.nio.ByteBuffer getByteBuffer​(int i)  
      static java.nio.ByteBuffer getByteBuffer​(long n)  
      static java.nio.ByteBuffer getByteBuffer​(java.lang.String s)  
      static int read​(java.nio.ByteBuffer buffer)
      read an unsigned byte(0 ~ 255) as InputStream does.
      static int readAsPossible​(TsFileInput input, long position, java.nio.ByteBuffer buffer)
      read bytes from buffer with offset position to the end of buffer.
      static int readAsPossible​(TsFileInput input, java.nio.ByteBuffer buffer)
      read util to the end of buffer.
      static int readAsPossible​(TsFileInput input, java.nio.ByteBuffer target, long offset, int len)
      read bytes from buffer with offset position to the end of buffer or up to len.
      static Binary readBinary​(java.io.InputStream inputStream)  
      static Binary readBinary​(java.nio.ByteBuffer buffer)  
      static boolean readBool​(java.io.InputStream inputStream)
      read a bool from inputStream.
      static boolean readBool​(java.nio.ByteBuffer buffer)
      read a bool from byteBuffer.
      static boolean readBoolean​(java.io.InputStream inputStream)  
      static java.lang.Boolean readBoolObject​(java.io.InputStream inputStream)
      read a Boolean from byteBuffer.
      static java.lang.Boolean readBoolObject​(java.nio.ByteBuffer buffer)
      read a Boolean from byteBuffer.
      static byte readByte​(java.io.InputStream inputStream)
      read a byte var from inputStream.
      static byte readByte​(java.nio.ByteBuffer buffer)
      read a byte from byteBuffer.
      static byte[] readByteBufferWithSelfDescriptionLength​(java.nio.ByteBuffer buffer)
      read bytes from byteBuffer, this method makes sure that you can read length bytes or reach to the end of the buffer.
      static byte[] readBytes​(java.io.InputStream inputStream, int length)
      unlike InputStream.read(bytes), this method makes sure that you can read length bytes or reach to the end of the stream.
      static byte[] readBytes​(java.nio.ByteBuffer buffer, int size)
      read bytes array in given size
      static byte[] readBytesWithSelfDescriptionLength​(java.io.InputStream inputStream)
      unlike InputStream.read(bytes), this method makes sure that you can read length bytes or reach to the end of the stream.
      static CompressionType readCompressionType​(java.io.InputStream inputStream)  
      static CompressionType readCompressionType​(java.nio.ByteBuffer buffer)  
      static TSDataType readDataType​(java.io.InputStream inputStream)  
      static TSDataType readDataType​(java.nio.ByteBuffer buffer)  
      static double readDouble​(java.io.InputStream inputStream)
      read a double var from inputStream.
      static double readDouble​(java.nio.ByteBuffer byteBuffer)
      read a double var from byteBuffer.
      static TSEncoding readEncoding​(java.io.InputStream inputStream)  
      static TSEncoding readEncoding​(java.nio.ByteBuffer buffer)  
      static float readFloat​(java.io.InputStream inputStream)
      read a float var from inputStream.
      static float readFloat​(java.nio.ByteBuffer byteBuffer)
      read a float var from byteBuffer.
      static int readInt​(java.io.InputStream inputStream)
      read a int var from inputStream.
      static int readInt​(java.nio.ByteBuffer buffer)
      read a int var from byteBuffer.
      static java.util.Set<java.lang.Integer> readIntegerSet​(java.nio.ByteBuffer buffer)
      read integer set with self define length.
      static boolean readIsNull​(java.io.InputStream inputStream)
      read a bool from byteBuffer.
      static boolean readIsNull​(java.nio.ByteBuffer buffer)
      read a bool from byteBuffer.
      static java.util.LinkedHashMap<java.lang.String,​java.lang.String> readLinkedHashMap​(java.nio.ByteBuffer buffer)  
      static long readLong​(java.io.InputStream inputStream)
      read a long var from inputStream.
      static long readLong​(java.nio.ByteBuffer buffer)
      read a long var from byteBuffer.
      static java.util.Map<java.lang.String,​java.lang.String> readMap​(java.io.InputStream inputStream)  
      static java.util.Map<java.lang.String,​java.lang.String> readMap​(java.nio.ByteBuffer buffer)  
      static java.util.List<java.util.Map<java.lang.String,​java.lang.String>> readMaps​(java.nio.ByteBuffer buffer, int totalSize)  
      static java.lang.Object readObject​(java.nio.ByteBuffer buffer)  
      static short readShort​(java.io.InputStream inputStream)
      read a short var from inputStream.
      static short readShort​(java.nio.ByteBuffer buffer)
      read a short var from byteBuffer.
      static java.lang.String readString​(java.io.InputStream inputStream)
      read string from inputStream.
      static java.lang.String readString​(java.nio.ByteBuffer buffer)
      read string from byteBuffer.
      static java.lang.String readStringFromDirectByteBuffer​(java.nio.ByteBuffer buffer)  
      static java.util.List<java.lang.String> readStringList​(java.io.InputStream inputStream)
      read string list with self define length.
      static java.util.List<java.lang.String> readStringList​(java.nio.ByteBuffer buffer)
      read string list with self define length.
      static java.lang.String readStringWithLength​(java.nio.ByteBuffer buffer, int length)
      read string from byteBuffer with user define length.
      static java.lang.String readVarIntString​(java.io.InputStream inputStream)
      string length's type is varInt
      static java.lang.String readVarIntString​(java.nio.ByteBuffer buffer)
      string length's type is varInt
      static int sizeToWrite​(java.lang.String s)  
      static int sizeToWrite​(Binary n)  
      static void skip​(java.io.InputStream inputStream, long n)
      The skip method of will return only if skipping n bytes or reaching end of file.
      static int write​(byte n, java.io.OutputStream outputStream)
      write a byte n.
      static int write​(byte n, java.nio.ByteBuffer buffer)
      write a byte n to byteBuffer.
      static int write​(double n, java.io.OutputStream outputStream)
      write a double n to outputStream.
      static int write​(double n, java.nio.ByteBuffer buffer)
      write a double n to byteBuffer.
      static int write​(float n, java.io.OutputStream outputStream)
      write a float n to outputStream.
      static int write​(float n, java.nio.ByteBuffer buffer)
      write a float n to byteBuffer.
      static int write​(int n, java.io.OutputStream outputStream)
      write a int n to outputStream.
      static int write​(int n, java.nio.ByteBuffer buffer)
      write a int n to byteBuffer.
      static int write​(long n, java.io.OutputStream outputStream)
      write a long n to outputStream.
      static int write​(long n, java.nio.ByteBuffer buffer)
      write a long n to byteBuffer.
      static int write​(short n, java.io.OutputStream outputStream)
      write a short n.
      static int write​(short n, java.nio.ByteBuffer buffer)
      write a short n to byteBuffer.
      static int write​(java.lang.Boolean flag, java.io.OutputStream outputStream)
      write a int value to outputStream according to flag.
      static int write​(java.lang.Boolean flag, java.nio.ByteBuffer buffer)
      write a byte to byteBuffer according to flag.
      static int write​(java.lang.String s, java.io.OutputStream outputStream)
      write string to outputStream.
      static int write​(java.lang.String s, java.nio.ByteBuffer buffer)
      write string to byteBuffer.
      static int write​(java.nio.ByteBuffer byteBuffer, java.io.OutputStream outputStream)
      write byteBuffer.capacity and byteBuffer.array to outputStream.
      static int write​(java.nio.ByteBuffer byteBuffer, java.nio.ByteBuffer buffer)
      write byteBuffer.capacity and byteBuffer.array to byteBuffer.
      static void write​(java.util.List<java.util.Map<java.lang.String,​java.lang.String>> maps, java.io.OutputStream stream)  
      static void write​(java.util.List<java.util.Map<java.lang.String,​java.lang.String>> maps, java.nio.ByteBuffer buffer)  
      static int write​(java.util.Map<java.lang.String,​java.lang.String> map, java.io.OutputStream stream)  
      static int write​(java.util.Map<java.lang.String,​java.lang.String> map, java.nio.ByteBuffer buffer)  
      static int write​(CompressionType compressionType, java.io.OutputStream outputStream)
      CompressionType.
      static int write​(CompressionType compressionType, java.nio.ByteBuffer buffer)
      write compressionType to byteBuffer.
      static int write​(TSDataType dataType, java.io.OutputStream outputStream)
      TSDataType.
      static int write​(TSDataType dataType, java.nio.ByteBuffer buffer)  
      static int write​(TSEncoding encoding, java.io.OutputStream outputStream)
      TSEncoding.
      static int write​(TSEncoding encoding, java.nio.ByteBuffer buffer)  
      static int write​(Binary binary, java.io.OutputStream outputStream)
      write the size (int) of the binary and then the bytes in binary
      static int write​(Binary n, java.nio.ByteBuffer buffer)
      write a short n to byteBuffer.
      static void writeIntegerSet​(java.util.Set<java.lang.Integer> set, java.io.OutputStream outputStream)
      write integer set with self define length.
      static void writeObject​(java.lang.Object value, java.io.DataOutputStream outputStream)  
      static void writeObject​(java.lang.Object value, java.nio.ByteBuffer byteBuffer)  
      static void writeStringList​(java.util.List<java.lang.String> list, java.io.OutputStream outputStream)
      write string list with self define length.
      static void writeStringList​(java.util.List<java.lang.String> list, java.nio.ByteBuffer buffer)
      write string list with self define length.
      static int writeVar​(java.lang.String s, java.io.OutputStream outputStream)
      write string to outputStream.
      static int writeVar​(java.lang.String s, java.nio.ByteBuffer buffer)  
      static void writeWithoutSize​(java.nio.ByteBuffer byteBuffer, int offset, int len, java.io.OutputStream outputStream)  
      • Methods inherited from class java.lang.Object

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

      • readBool

        public static boolean readBool​(java.io.InputStream inputStream)
                                throws java.io.IOException
        read a bool from inputStream.
        Throws:
        java.io.IOException
      • readBoolean

        public static boolean readBoolean​(java.io.InputStream inputStream)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • readBool

        public static boolean readBool​(java.nio.ByteBuffer buffer)
        read a bool from byteBuffer.
      • readBoolObject

        public static java.lang.Boolean readBoolObject​(java.nio.ByteBuffer buffer)
        read a Boolean from byteBuffer.
      • readBoolObject

        public static java.lang.Boolean readBoolObject​(java.io.InputStream inputStream)
                                                throws java.io.IOException
        read a Boolean from byteBuffer.
        Throws:
        java.io.IOException
      • readByte

        public static byte readByte​(java.nio.ByteBuffer buffer)
        read a byte from byteBuffer.
      • readBytes

        public static byte[] readBytes​(java.nio.ByteBuffer buffer,
                                       int size)
        read bytes array in given size
        Parameters:
        buffer - buffer
        size - size
        Returns:
        bytes array
      • readIsNull

        public static boolean readIsNull​(java.io.InputStream inputStream)
                                  throws java.io.IOException
        read a bool from byteBuffer.
        Throws:
        java.io.IOException
      • readIsNull

        public static boolean readIsNull​(java.nio.ByteBuffer buffer)
        read a bool from byteBuffer.
      • write

        public static int write​(java.util.Map<java.lang.String,​java.lang.String> map,
                                java.io.OutputStream stream)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • write

        public static void write​(java.util.List<java.util.Map<java.lang.String,​java.lang.String>> maps,
                                 java.io.OutputStream stream)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • write

        public static int write​(java.util.Map<java.lang.String,​java.lang.String> map,
                                java.nio.ByteBuffer buffer)
      • write

        public static void write​(java.util.List<java.util.Map<java.lang.String,​java.lang.String>> maps,
                                 java.nio.ByteBuffer buffer)
      • write

        public static int write​(java.lang.Boolean flag,
                                java.io.OutputStream outputStream)
                         throws java.io.IOException
        write a int value to outputStream according to flag. If flag is true, write 1, else write 0.
        Throws:
        java.io.IOException
      • write

        public static int write​(java.lang.Boolean flag,
                                java.nio.ByteBuffer buffer)
        write a byte to byteBuffer according to flag. If flag is true, write 1, else write 0.
      • write

        public static int write​(byte n,
                                java.io.OutputStream outputStream)
                         throws java.io.IOException
        write a byte n.
        Returns:
        The number of bytes used to represent a byte value in two's complement binary form.
        Throws:
        java.io.IOException
      • write

        public static int write​(short n,
                                java.io.OutputStream outputStream)
                         throws java.io.IOException
        write a short n.
        Returns:
        The number of bytes used to represent n.
        Throws:
        java.io.IOException
      • write

        public static int write​(byte n,
                                java.nio.ByteBuffer buffer)
        write a byte n to byteBuffer.
        Returns:
        The number of bytes used to represent a byte value in two's complement binary form.
      • write

        public static int write​(short n,
                                java.nio.ByteBuffer buffer)
        write a short n to byteBuffer.
        Returns:
        The number of bytes used to represent n.
      • write

        public static int write​(Binary n,
                                java.nio.ByteBuffer buffer)
        write a short n to byteBuffer.
        Returns:
        The number of bytes used to represent n.
      • write

        public static int write​(int n,
                                java.io.OutputStream outputStream)
                         throws java.io.IOException
        write a int n to outputStream.
        Returns:
        The number of bytes used to represent n.
        Throws:
        java.io.IOException
      • write

        public static int write​(Binary binary,
                                java.io.OutputStream outputStream)
                         throws java.io.IOException
        write the size (int) of the binary and then the bytes in binary
        Throws:
        java.io.IOException
      • write

        public static int write​(int n,
                                java.nio.ByteBuffer buffer)
        write a int n to byteBuffer.
        Returns:
        The number of bytes used to represent n.
      • write

        public static int write​(float n,
                                java.io.OutputStream outputStream)
                         throws java.io.IOException
        write a float n to outputStream.
        Returns:
        The number of bytes used to represent n.
        Throws:
        java.io.IOException
      • write

        public static int write​(double n,
                                java.io.OutputStream outputStream)
                         throws java.io.IOException
        write a double n to outputStream.
        Returns:
        The number of bytes used to represent n.
        Throws:
        java.io.IOException
      • write

        public static int write​(long n,
                                java.io.OutputStream outputStream)
                         throws java.io.IOException
        write a long n to outputStream.
        Returns:
        The number of bytes used to represent n.
        Throws:
        java.io.IOException
      • write

        public static int write​(long n,
                                java.nio.ByteBuffer buffer)
        write a long n to byteBuffer.
      • write

        public static int write​(float n,
                                java.nio.ByteBuffer buffer)
        write a float n to byteBuffer.
      • write

        public static int write​(double n,
                                java.nio.ByteBuffer buffer)
        write a double n to byteBuffer.
      • write

        public static int write​(java.lang.String s,
                                java.io.OutputStream outputStream)
                         throws java.io.IOException
        write string to outputStream.
        Returns:
        the length of string represented by byte[].
        Throws:
        java.io.IOException
      • writeVar

        public static int writeVar​(java.lang.String s,
                                   java.io.OutputStream outputStream)
                            throws java.io.IOException
        write string to outputStream.
        Returns:
        the length of string represented by byte[].
        Throws:
        java.io.IOException
      • write

        public static int write​(java.lang.String s,
                                java.nio.ByteBuffer buffer)
        write string to byteBuffer.
        Returns:
        the length of string represented by byte[].
      • writeVar

        public static int writeVar​(java.lang.String s,
                                   java.nio.ByteBuffer buffer)
      • write

        public static int write​(java.nio.ByteBuffer byteBuffer,
                                java.io.OutputStream outputStream)
                         throws java.io.IOException
        write byteBuffer.capacity and byteBuffer.array to outputStream.
        Throws:
        java.io.IOException
      • writeWithoutSize

        public static void writeWithoutSize​(java.nio.ByteBuffer byteBuffer,
                                            int offset,
                                            int len,
                                            java.io.OutputStream outputStream)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • write

        public static int write​(java.nio.ByteBuffer byteBuffer,
                                java.nio.ByteBuffer buffer)
        write byteBuffer.capacity and byteBuffer.array to byteBuffer.
      • write

        public static int write​(CompressionType compressionType,
                                java.io.OutputStream outputStream)
                         throws java.io.IOException
        CompressionType.
        Throws:
        java.io.IOException
      • write

        public static int write​(CompressionType compressionType,
                                java.nio.ByteBuffer buffer)
        write compressionType to byteBuffer.
      • write

        public static int write​(TSDataType dataType,
                                java.io.OutputStream outputStream)
                         throws java.io.IOException
        TSDataType.
        Throws:
        java.io.IOException
      • write

        public static int write​(TSDataType dataType,
                                java.nio.ByteBuffer buffer)
      • write

        public static int write​(TSEncoding encoding,
                                java.io.OutputStream outputStream)
                         throws java.io.IOException
        TSEncoding.
        Throws:
        java.io.IOException
      • write

        public static int write​(TSEncoding encoding,
                                java.nio.ByteBuffer buffer)
      • sizeToWrite

        public static int sizeToWrite​(Binary n)
      • sizeToWrite

        public static int sizeToWrite​(java.lang.String s)
      • readByte

        public static byte readByte​(java.io.InputStream inputStream)
                             throws java.io.IOException
        read a byte var from inputStream.
        Throws:
        java.io.IOException
      • readShort

        public static short readShort​(java.io.InputStream inputStream)
                               throws java.io.IOException
        read a short var from inputStream.
        Throws:
        java.io.IOException
      • readShort

        public static short readShort​(java.nio.ByteBuffer buffer)
        read a short var from byteBuffer.
      • readFloat

        public static float readFloat​(java.io.InputStream inputStream)
                               throws java.io.IOException
        read a float var from inputStream.
        Throws:
        java.io.IOException
      • readFloat

        public static float readFloat​(java.nio.ByteBuffer byteBuffer)
        read a float var from byteBuffer.
      • readDouble

        public static double readDouble​(java.io.InputStream inputStream)
                                 throws java.io.IOException
        read a double var from inputStream.
        Throws:
        java.io.IOException
      • readDouble

        public static double readDouble​(java.nio.ByteBuffer byteBuffer)
        read a double var from byteBuffer.
      • readInt

        public static int readInt​(java.io.InputStream inputStream)
                           throws java.io.IOException
        read a int var from inputStream.
        Throws:
        java.io.IOException
      • readInt

        public static int readInt​(java.nio.ByteBuffer buffer)
        read a int var from byteBuffer.
      • read

        public static int read​(java.nio.ByteBuffer buffer)
        read an unsigned byte(0 ~ 255) as InputStream does.
        Returns:
        the byte or -1(means there is no byte to read)
      • readLong

        public static long readLong​(java.io.InputStream inputStream)
                             throws java.io.IOException
        read a long var from inputStream.
        Throws:
        java.io.IOException
      • readLong

        public static long readLong​(java.nio.ByteBuffer buffer)
        read a long var from byteBuffer.
      • readString

        public static java.lang.String readString​(java.io.InputStream inputStream)
                                           throws java.io.IOException
        read string from inputStream.
        Throws:
        java.io.IOException
      • readVarIntString

        public static java.lang.String readVarIntString​(java.io.InputStream inputStream)
                                                 throws java.io.IOException
        string length's type is varInt
        Throws:
        java.io.IOException
      • readString

        public static java.lang.String readString​(java.nio.ByteBuffer buffer)
        read string from byteBuffer.
      • readVarIntString

        public static java.lang.String readVarIntString​(java.nio.ByteBuffer buffer)
        string length's type is varInt
      • readStringWithLength

        public static java.lang.String readStringWithLength​(java.nio.ByteBuffer buffer,
                                                            int length)
        read string from byteBuffer with user define length.
      • getByteBuffer

        public static java.nio.ByteBuffer getByteBuffer​(java.lang.String s)
      • getByteBuffer

        public static java.nio.ByteBuffer getByteBuffer​(int i)
      • getByteBuffer

        public static java.nio.ByteBuffer getByteBuffer​(long n)
      • getByteBuffer

        public static java.nio.ByteBuffer getByteBuffer​(float f)
      • getByteBuffer

        public static java.nio.ByteBuffer getByteBuffer​(double d)
      • getByteBuffer

        public static java.nio.ByteBuffer getByteBuffer​(boolean i)
      • readStringFromDirectByteBuffer

        public static java.lang.String readStringFromDirectByteBuffer​(java.nio.ByteBuffer buffer)
                                                               throws java.nio.charset.CharacterCodingException
        Throws:
        java.nio.charset.CharacterCodingException
      • readBytes

        public static byte[] readBytes​(java.io.InputStream inputStream,
                                       int length)
                                throws java.io.IOException
        unlike InputStream.read(bytes), this method makes sure that you can read length bytes or reach to the end of the stream.
        Throws:
        java.io.IOException
      • readMap

        public static java.util.Map<java.lang.String,​java.lang.String> readMap​(java.nio.ByteBuffer buffer)
      • readMap

        public static java.util.Map<java.lang.String,​java.lang.String> readMap​(java.io.InputStream inputStream)
                                                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • readLinkedHashMap

        public static java.util.LinkedHashMap<java.lang.String,​java.lang.String> readLinkedHashMap​(java.nio.ByteBuffer buffer)
      • readMaps

        public static java.util.List<java.util.Map<java.lang.String,​java.lang.String>> readMaps​(java.nio.ByteBuffer buffer,
                                                                                                      int totalSize)
      • readBytesWithSelfDescriptionLength

        public static byte[] readBytesWithSelfDescriptionLength​(java.io.InputStream inputStream)
                                                         throws java.io.IOException
        unlike InputStream.read(bytes), this method makes sure that you can read length bytes or reach to the end of the stream.
        Throws:
        java.io.IOException
      • readBinary

        public static Binary readBinary​(java.nio.ByteBuffer buffer)
      • readBinary

        public static Binary readBinary​(java.io.InputStream inputStream)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • readByteBufferWithSelfDescriptionLength

        public static byte[] readByteBufferWithSelfDescriptionLength​(java.nio.ByteBuffer buffer)
        read bytes from byteBuffer, this method makes sure that you can read length bytes or reach to the end of the buffer.

        read a int + buffer

      • readAsPossible

        public static int readAsPossible​(TsFileInput input,
                                         long position,
                                         java.nio.ByteBuffer buffer)
                                  throws java.io.IOException
        read bytes from buffer with offset position to the end of buffer.
        Throws:
        java.io.IOException
      • readAsPossible

        public static int readAsPossible​(TsFileInput input,
                                         java.nio.ByteBuffer buffer)
                                  throws java.io.IOException
        read util to the end of buffer.
        Throws:
        java.io.IOException
      • readAsPossible

        public static int readAsPossible​(TsFileInput input,
                                         java.nio.ByteBuffer target,
                                         long offset,
                                         int len)
                                  throws java.io.IOException
        read bytes from buffer with offset position to the end of buffer or up to len.
        Throws:
        java.io.IOException
      • readStringList

        public static java.util.List<java.lang.String> readStringList​(java.io.InputStream inputStream)
                                                               throws java.io.IOException
        read string list with self define length.
        Throws:
        java.io.IOException
      • readStringList

        public static java.util.List<java.lang.String> readStringList​(java.nio.ByteBuffer buffer)
        read string list with self define length.
      • writeStringList

        public static void writeStringList​(java.util.List<java.lang.String> list,
                                           java.nio.ByteBuffer buffer)
        write string list with self define length.
      • writeStringList

        public static void writeStringList​(java.util.List<java.lang.String> list,
                                           java.io.OutputStream outputStream)
                                    throws java.io.IOException
        write string list with self define length.
        Throws:
        java.io.IOException
      • readIntegerSet

        public static java.util.Set<java.lang.Integer> readIntegerSet​(java.nio.ByteBuffer buffer)
        read integer set with self define length.
      • writeIntegerSet

        public static void writeIntegerSet​(java.util.Set<java.lang.Integer> set,
                                           java.io.OutputStream outputStream)
                                    throws java.io.IOException
        write integer set with self define length.
        Throws:
        java.io.IOException
      • readCompressionType

        public static CompressionType readCompressionType​(java.io.InputStream inputStream)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • readCompressionType

        public static CompressionType readCompressionType​(java.nio.ByteBuffer buffer)
      • readDataType

        public static TSDataType readDataType​(java.io.InputStream inputStream)
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • readDataType

        public static TSDataType readDataType​(java.nio.ByteBuffer buffer)
      • readEncoding

        public static TSEncoding readEncoding​(java.io.InputStream inputStream)
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • readEncoding

        public static TSEncoding readEncoding​(java.nio.ByteBuffer buffer)
      • checkIfMagicString

        public static boolean checkIfMagicString​(java.nio.ByteBuffer byteBuffer)
        to check whether the byte buffer is reach the magic string this method doesn't change the position of the byte buffer
        Parameters:
        byteBuffer - byte buffer
        Returns:
        whether the byte buffer is reach the magic string
      • checkIfMagicString

        public static boolean checkIfMagicString​(java.io.InputStream inputStream)
                                          throws java.io.IOException
        to check whether the inputStream is reach the magic string this method doesn't change the position of the inputStream
        Parameters:
        inputStream - inputStream
        Returns:
        whether the inputStream is reach the magic string
        Throws:
        java.io.IOException
      • writeObject

        public static void writeObject​(java.lang.Object value,
                                       java.io.DataOutputStream outputStream)
      • writeObject

        public static void writeObject​(java.lang.Object value,
                                       java.nio.ByteBuffer byteBuffer)
      • readObject

        public static java.lang.Object readObject​(java.nio.ByteBuffer buffer)
      • clone

        public static java.nio.ByteBuffer clone​(java.nio.ByteBuffer original)
      • skip

        public static void skip​(java.io.InputStream inputStream,
                                long n)
                         throws java.io.IOException
        The skip method of will return only if skipping n bytes or reaching end of file.
        Parameters:
        inputStream - the inputSteam to be skipped.
        n - the number of bytes to be skipped.
        Throws:
        java.io.IOException - if the stream does not support seek, or if some other I/O error occurs.