Package org.apache.iotdb.tsfile.utils
Class ReadWriteIOUtils
- java.lang.Object
-
- org.apache.iotdb.tsfile.utils.ReadWriteIOUtils
-
public class ReadWriteIOUtils extends java.lang.ObjectConverterUtils is a utility class. It provides conversion between normal datatype and byte array.
-
-
Field Summary
Fields Modifier and Type Field Description static floatBIT_LENstatic intBOOLEAN_LENstatic intDOUBLE_LENstatic intFLOAT_LENstatic intINT_LENstatic intLONG_LENstatic intSHORT_LEN
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancheckIfMagicString(java.io.InputStream inputStream)to check whether the inputStream is reach the magic string this method doesn't change the position of the inputStreamstatic booleancheckIfMagicString(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 bufferstatic java.nio.ByteBufferclone(java.nio.ByteBuffer original)static java.nio.ByteBuffergetByteBuffer(boolean i)static java.nio.ByteBuffergetByteBuffer(double d)static java.nio.ByteBuffergetByteBuffer(float f)static java.nio.ByteBuffergetByteBuffer(int i)static java.nio.ByteBuffergetByteBuffer(long n)static java.nio.ByteBuffergetByteBuffer(java.lang.String s)static intread(java.nio.ByteBuffer buffer)read an unsigned byte(0 ~ 255) as InputStream does.static intreadAsPossible(TsFileInput input, long position, java.nio.ByteBuffer buffer)read bytes from buffer with offset position to the end of buffer.static intreadAsPossible(TsFileInput input, java.nio.ByteBuffer buffer)read util to the end of buffer.static intreadAsPossible(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 BinaryreadBinary(java.io.InputStream inputStream)static BinaryreadBinary(java.nio.ByteBuffer buffer)static booleanreadBool(java.io.InputStream inputStream)read a bool from inputStream.static booleanreadBool(java.nio.ByteBuffer buffer)read a bool from byteBuffer.static booleanreadBoolean(java.io.InputStream inputStream)static java.lang.BooleanreadBoolObject(java.io.InputStream inputStream)read a Boolean from byteBuffer.static java.lang.BooleanreadBoolObject(java.nio.ByteBuffer buffer)read a Boolean from byteBuffer.static bytereadByte(java.io.InputStream inputStream)read a byte var from inputStream.static bytereadByte(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 sizestatic 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 CompressionTypereadCompressionType(java.io.InputStream inputStream)static CompressionTypereadCompressionType(java.nio.ByteBuffer buffer)static TSDataTypereadDataType(java.io.InputStream inputStream)static TSDataTypereadDataType(java.nio.ByteBuffer buffer)static doublereadDouble(java.io.InputStream inputStream)read a double var from inputStream.static doublereadDouble(java.nio.ByteBuffer byteBuffer)read a double var from byteBuffer.static TSEncodingreadEncoding(java.io.InputStream inputStream)static TSEncodingreadEncoding(java.nio.ByteBuffer buffer)static floatreadFloat(java.io.InputStream inputStream)read a float var from inputStream.static floatreadFloat(java.nio.ByteBuffer byteBuffer)read a float var from byteBuffer.static intreadInt(java.io.InputStream inputStream)read a int var from inputStream.static intreadInt(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 booleanreadIsNull(java.io.InputStream inputStream)read a bool from byteBuffer.static booleanreadIsNull(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 longreadLong(java.io.InputStream inputStream)read a long var from inputStream.static longreadLong(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.ObjectreadObject(java.nio.ByteBuffer buffer)static shortreadShort(java.io.InputStream inputStream)read a short var from inputStream.static shortreadShort(java.nio.ByteBuffer buffer)read a short var from byteBuffer.static java.lang.StringreadString(java.io.InputStream inputStream)read string from inputStream.static java.lang.StringreadString(java.nio.ByteBuffer buffer)read string from byteBuffer.static java.lang.StringreadStringFromDirectByteBuffer(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.StringreadStringWithLength(java.nio.ByteBuffer buffer, int length)read string from byteBuffer with user define length.static java.lang.StringreadVarIntString(java.io.InputStream inputStream)string length's type is varIntstatic java.lang.StringreadVarIntString(java.nio.ByteBuffer buffer)string length's type is varIntstatic intsizeToWrite(java.lang.String s)static intsizeToWrite(Binary n)static voidskip(java.io.InputStream inputStream, long n)The skip method of will return only if skipping n bytes or reaching end of file.static intwrite(byte n, java.io.OutputStream outputStream)write a byte n.static intwrite(byte n, java.nio.ByteBuffer buffer)write a byte n to byteBuffer.static intwrite(double n, java.io.OutputStream outputStream)write a double n to outputStream.static intwrite(double n, java.nio.ByteBuffer buffer)write a double n to byteBuffer.static intwrite(float n, java.io.OutputStream outputStream)write a float n to outputStream.static intwrite(float n, java.nio.ByteBuffer buffer)write a float n to byteBuffer.static intwrite(int n, java.io.OutputStream outputStream)write a int n to outputStream.static intwrite(int n, java.nio.ByteBuffer buffer)write a int n to byteBuffer.static intwrite(long n, java.io.OutputStream outputStream)write a long n to outputStream.static intwrite(long n, java.nio.ByteBuffer buffer)write a long n to byteBuffer.static intwrite(short n, java.io.OutputStream outputStream)write a short n.static intwrite(short n, java.nio.ByteBuffer buffer)write a short n to byteBuffer.static intwrite(java.lang.Boolean flag, java.io.OutputStream outputStream)write a int value to outputStream according to flag.static intwrite(java.lang.Boolean flag, java.nio.ByteBuffer buffer)write a byte to byteBuffer according to flag.static intwrite(java.lang.String s, java.io.OutputStream outputStream)write string to outputStream.static intwrite(java.lang.String s, java.nio.ByteBuffer buffer)write string to byteBuffer.static intwrite(java.nio.ByteBuffer byteBuffer, java.io.OutputStream outputStream)write byteBuffer.capacity and byteBuffer.array to outputStream.static intwrite(java.nio.ByteBuffer byteBuffer, java.nio.ByteBuffer buffer)write byteBuffer.capacity and byteBuffer.array to byteBuffer.static voidwrite(java.util.List<java.util.Map<java.lang.String,java.lang.String>> maps, java.io.OutputStream stream)static voidwrite(java.util.List<java.util.Map<java.lang.String,java.lang.String>> maps, java.nio.ByteBuffer buffer)static intwrite(java.util.Map<java.lang.String,java.lang.String> map, java.io.OutputStream stream)static intwrite(java.util.Map<java.lang.String,java.lang.String> map, java.nio.ByteBuffer buffer)static intwrite(CompressionType compressionType, java.io.OutputStream outputStream)CompressionType.static intwrite(CompressionType compressionType, java.nio.ByteBuffer buffer)write compressionType to byteBuffer.static intwrite(TSDataType dataType, java.io.OutputStream outputStream)TSDataType.static intwrite(TSDataType dataType, java.nio.ByteBuffer buffer)static intwrite(TSEncoding encoding, java.io.OutputStream outputStream)TSEncoding.static intwrite(TSEncoding encoding, java.nio.ByteBuffer buffer)static intwrite(Binary binary, java.io.OutputStream outputStream)write the size (int) of the binary and then the bytes in binarystatic intwrite(Binary n, java.nio.ByteBuffer buffer)write a short n to byteBuffer.static voidwriteIntegerSet(java.util.Set<java.lang.Integer> set, java.io.OutputStream outputStream)write integer set with self define length.static voidwriteObject(java.lang.Object value, java.io.DataOutputStream outputStream)static voidwriteObject(java.lang.Object value, java.nio.ByteBuffer byteBuffer)static voidwriteStringList(java.util.List<java.lang.String> list, java.io.OutputStream outputStream)write string list with self define length.static voidwriteStringList(java.util.List<java.lang.String> list, java.nio.ByteBuffer buffer)write string list with self define length.static intwriteVar(java.lang.String s, java.io.OutputStream outputStream)write string to outputStream.static intwriteVar(java.lang.String s, java.nio.ByteBuffer buffer)static voidwriteWithoutSize(java.nio.ByteBuffer byteBuffer, int offset, int len, java.io.OutputStream outputStream)
-
-
-
Field Detail
-
BOOLEAN_LEN
public static final int BOOLEAN_LEN
- See Also:
- Constant Field Values
-
SHORT_LEN
public static final int SHORT_LEN
- See Also:
- Constant Field Values
-
INT_LEN
public static final int INT_LEN
- See Also:
- Constant Field Values
-
LONG_LEN
public static final int LONG_LEN
- See Also:
- Constant Field Values
-
DOUBLE_LEN
public static final int DOUBLE_LEN
- See Also:
- Constant Field Values
-
FLOAT_LEN
public static final int FLOAT_LEN
- See Also:
- Constant Field Values
-
BIT_LEN
public static final float BIT_LEN
- See Also:
- Constant Field Values
-
-
Method Detail
-
readBool
public static boolean readBool(java.io.InputStream inputStream) throws java.io.IOExceptionread 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.IOExceptionread 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- buffersize- size- Returns:
- bytes array
-
readIsNull
public static boolean readIsNull(java.io.InputStream inputStream) throws java.io.IOExceptionread 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.IOExceptionwrite 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.IOExceptionwrite a byte n.- Returns:
- The number of bytes used to represent a
bytevalue in two's complement binary form. - Throws:
java.io.IOException
-
write
public static int write(short n, java.io.OutputStream outputStream) throws java.io.IOExceptionwrite 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
bytevalue 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.IOExceptionwrite 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.IOExceptionwrite 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.IOExceptionwrite 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.IOExceptionwrite 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.IOExceptionwrite 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.IOExceptionwrite 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.IOExceptionwrite 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.IOExceptionread a byte var from inputStream.- Throws:
java.io.IOException
-
readShort
public static short readShort(java.io.InputStream inputStream) throws java.io.IOExceptionread 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.IOExceptionread 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.IOExceptionread 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.IOExceptionread 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.IOExceptionread 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.IOExceptionread string from inputStream.- Throws:
java.io.IOException
-
readVarIntString
public static java.lang.String readVarIntString(java.io.InputStream inputStream) throws java.io.IOExceptionstring 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.IOExceptionunlike 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.IOExceptionunlike 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.IOExceptionread 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.IOExceptionwrite 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.IOExceptionwrite 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.IOExceptionto 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.IOExceptionThe 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.
-
-