public class ReadWriteIOUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static float |
BIT_LEN |
static int |
BOOLEAN_LEN |
static int |
DOUBLE_LEN |
static int |
FLOAT_LEN |
static int |
INT_LEN |
static int |
LONG_LEN |
static int |
SHORT_LEN |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkIfMagicString(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 boolean |
checkIfMagicString(InputStream inputStream)
to check whether the inputStream is reach the magic string this method doesn't change the
position of the inputStream
|
static ByteBuffer |
clone(ByteBuffer original) |
static ByteBuffer |
getByteBuffer(boolean i) |
static ByteBuffer |
getByteBuffer(double d) |
static ByteBuffer |
getByteBuffer(float f) |
static ByteBuffer |
getByteBuffer(int i) |
static ByteBuffer |
getByteBuffer(long n) |
static ByteBuffer |
getByteBuffer(String s) |
static int |
read(ByteBuffer buffer)
read an unsigned byte(0 ~ 255) as InputStream does.
|
static int |
readAsPossible(TsFileInput input,
ByteBuffer buffer)
read util to the end of buffer.
|
static int |
readAsPossible(TsFileInput input,
ByteBuffer target,
long offset,
int len)
read bytes from buffer with offset position to the end of buffer or up to len.
|
static int |
readAsPossible(TsFileInput input,
long position,
ByteBuffer buffer)
read bytes from buffer with offset position to the end of buffer.
|
static Binary |
readBinary(ByteBuffer buffer) |
static Binary |
readBinary(InputStream inputStream) |
static boolean |
readBool(ByteBuffer buffer)
read a bool from byteBuffer.
|
static boolean |
readBool(InputStream inputStream)
read a bool from inputStream.
|
static byte |
readByte(ByteBuffer buffer)
read a byte from byteBuffer.
|
static byte |
readByte(InputStream inputStream)
read a byte var from inputStream.
|
static byte[] |
readByteBufferWithSelfDescriptionLength(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(ByteBuffer buffer,
int size)
read bytes array in given size
|
static byte[] |
readBytes(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[] |
readBytesWithSelfDescriptionLength(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(ByteBuffer buffer) |
static CompressionType |
readCompressionType(InputStream inputStream) |
static TSDataType |
readDataType(ByteBuffer buffer) |
static TSDataType |
readDataType(InputStream inputStream) |
static double |
readDouble(ByteBuffer byteBuffer)
read a double var from byteBuffer.
|
static double |
readDouble(InputStream inputStream)
read a double var from inputStream.
|
static TSEncoding |
readEncoding(ByteBuffer buffer) |
static TSEncoding |
readEncoding(InputStream inputStream) |
static float |
readFloat(ByteBuffer byteBuffer)
read a float var from byteBuffer.
|
static float |
readFloat(InputStream inputStream)
read a float var from inputStream.
|
static int |
readInt(ByteBuffer buffer)
read a int var from byteBuffer.
|
static int |
readInt(InputStream inputStream)
read a int var from inputStream.
|
static boolean |
readIsNull(ByteBuffer buffer)
read a bool from byteBuffer.
|
static boolean |
readIsNull(InputStream inputStream)
read a bool from byteBuffer.
|
static long |
readLong(ByteBuffer buffer)
read a long var from byteBuffer.
|
static long |
readLong(InputStream inputStream)
read a long var from inputStream.
|
static Map<String,String> |
readMap(ByteBuffer buffer) |
static List<Map<String,String>> |
readMaps(ByteBuffer buffer,
int totalSize) |
static Object |
readObject(ByteBuffer buffer) |
static short |
readShort(ByteBuffer buffer)
read a short var from byteBuffer.
|
static short |
readShort(InputStream inputStream)
read a short var from inputStream.
|
static String |
readString(ByteBuffer buffer)
read string from byteBuffer.
|
static String |
readString(InputStream inputStream)
read string from inputStream.
|
static String |
readStringFromDirectByteBuffer(ByteBuffer buffer) |
static List<String> |
readStringList(ByteBuffer buffer)
read string list with self define length.
|
static List<String> |
readStringList(InputStream inputStream)
read string list with self define length.
|
static String |
readStringWithLength(ByteBuffer buffer,
int length)
read string from byteBuffer with user define length.
|
static String |
readVarIntString(ByteBuffer buffer)
string length's type is varInt
|
static String |
readVarIntString(InputStream inputStream)
string length's type is varInt
|
static int |
sizeToWrite(Binary n) |
static int |
sizeToWrite(String s) |
static int |
write(Binary n,
ByteBuffer buffer)
write a short n to byteBuffer.
|
static int |
write(Binary binary,
OutputStream outputStream)
write the size (int) of the binary and then the bytes in binary
|
static int |
write(Boolean flag,
ByteBuffer buffer)
write a byte to byteBuffer according to flag.
|
static int |
write(Boolean flag,
OutputStream outputStream)
write a int value to outputStream according to flag.
|
static int |
write(ByteBuffer byteBuffer,
ByteBuffer buffer)
write byteBuffer.capacity and byteBuffer.array to byteBuffer.
|
static int |
write(ByteBuffer byteBuffer,
OutputStream outputStream)
write byteBuffer.capacity and byteBuffer.array to outputStream.
|
static int |
write(byte n,
ByteBuffer buffer)
write a byte n to byteBuffer.
|
static int |
write(byte n,
OutputStream outputStream)
write a byte n.
|
static int |
write(CompressionType compressionType,
ByteBuffer buffer)
write compressionType to byteBuffer.
|
static int |
write(CompressionType compressionType,
OutputStream outputStream)
CompressionType.
|
static int |
write(double n,
ByteBuffer buffer)
write a double n to byteBuffer.
|
static int |
write(double n,
OutputStream outputStream)
write a double n to outputStream.
|
static int |
write(float n,
ByteBuffer buffer)
write a float n to byteBuffer.
|
static int |
write(float n,
OutputStream outputStream)
write a float n to outputStream.
|
static int |
write(int n,
ByteBuffer buffer)
write a int n to byteBuffer.
|
static int |
write(int n,
OutputStream outputStream)
write a int n to outputStream.
|
static void |
write(List<Map<String,String>> maps,
ByteBuffer buffer) |
static void |
write(List<Map<String,String>> maps,
OutputStream stream) |
static int |
write(long n,
ByteBuffer buffer)
write a long n to byteBuffer.
|
static int |
write(long n,
OutputStream outputStream)
write a long n to outputStream.
|
static int |
write(Map<String,String> map,
ByteBuffer buffer) |
static int |
write(Map<String,String> map,
OutputStream stream) |
static int |
write(short n,
ByteBuffer buffer)
write a short n to byteBuffer.
|
static int |
write(short n,
OutputStream outputStream)
write a short n.
|
static int |
write(String s,
ByteBuffer buffer)
write string to byteBuffer.
|
static int |
write(String s,
OutputStream outputStream)
write string to outputStream.
|
static int |
write(TSDataType dataType,
ByteBuffer buffer) |
static int |
write(TSDataType dataType,
OutputStream outputStream)
TSDataType.
|
static int |
write(TSEncoding encoding,
ByteBuffer buffer) |
static int |
write(TSEncoding encoding,
OutputStream outputStream)
TSEncoding.
|
static void |
writeObject(Object value,
ByteBuffer byteBuffer) |
static void |
writeObject(Object value,
DataOutputStream outputStream) |
static void |
writeStringList(List<String> list,
ByteBuffer buffer)
write string list with self define length.
|
static int |
writeVar(String s,
ByteBuffer buffer) |
static int |
writeVar(String s,
OutputStream outputStream)
write string to outputStream.
|
static void |
writeWithoutSize(ByteBuffer byteBuffer,
int offset,
int len,
OutputStream outputStream) |
public static final int BOOLEAN_LEN
public static final int SHORT_LEN
public static final int INT_LEN
public static final int LONG_LEN
public static final int DOUBLE_LEN
public static final int FLOAT_LEN
public static final float BIT_LEN
public static boolean readBool(InputStream inputStream) throws IOException
IOExceptionpublic static boolean readBool(ByteBuffer buffer)
public static byte readByte(ByteBuffer buffer)
public static byte[] readBytes(ByteBuffer buffer, int size)
buffer - buffersize - sizepublic static boolean readIsNull(InputStream inputStream) throws IOException
IOExceptionpublic static boolean readIsNull(ByteBuffer buffer)
public static int write(Map<String,String> map, OutputStream stream) throws IOException
IOExceptionpublic static void write(List<Map<String,String>> maps, OutputStream stream) throws IOException
IOExceptionpublic static int write(Map<String,String> map, ByteBuffer buffer)
public static void write(List<Map<String,String>> maps, ByteBuffer buffer)
public static int write(Boolean flag, OutputStream outputStream) throws IOException
IOExceptionpublic static int write(Boolean flag, ByteBuffer buffer)
public static int write(byte n,
OutputStream outputStream)
throws IOException
byte value in two's complement binary
form.IOExceptionpublic static int write(short n,
OutputStream outputStream)
throws IOException
IOExceptionpublic static int write(byte n,
ByteBuffer buffer)
byte value in two's complement binary
form.public static int write(short n,
ByteBuffer buffer)
public static int write(Binary n, ByteBuffer buffer)
public static int write(int n,
OutputStream outputStream)
throws IOException
IOExceptionpublic static int write(Binary binary, OutputStream outputStream) throws IOException
IOExceptionpublic static int write(int n,
ByteBuffer buffer)
public static int write(float n,
OutputStream outputStream)
throws IOException
IOExceptionpublic static int write(double n,
OutputStream outputStream)
throws IOException
IOExceptionpublic static int write(long n,
OutputStream outputStream)
throws IOException
IOExceptionpublic static int write(long n,
ByteBuffer buffer)
public static int write(float n,
ByteBuffer buffer)
public static int write(double n,
ByteBuffer buffer)
public static int write(String s, OutputStream outputStream) throws IOException
IOExceptionpublic static int writeVar(String s, OutputStream outputStream) throws IOException
IOExceptionpublic static int write(String s, ByteBuffer buffer)
public static int writeVar(String s, ByteBuffer buffer)
public static int write(ByteBuffer byteBuffer, OutputStream outputStream) throws IOException
IOExceptionpublic static void writeWithoutSize(ByteBuffer byteBuffer, int offset, int len, OutputStream outputStream) throws IOException
IOExceptionpublic static int write(ByteBuffer byteBuffer, ByteBuffer buffer)
public static int write(CompressionType compressionType, OutputStream outputStream) throws IOException
IOExceptionpublic static int write(CompressionType compressionType, ByteBuffer buffer)
public static int write(TSDataType dataType, OutputStream outputStream) throws IOException
IOExceptionpublic static int write(TSDataType dataType, ByteBuffer buffer)
public static int write(TSEncoding encoding, OutputStream outputStream) throws IOException
IOExceptionpublic static int write(TSEncoding encoding, ByteBuffer buffer)
public static int sizeToWrite(Binary n)
public static int sizeToWrite(String s)
public static byte readByte(InputStream inputStream) throws IOException
IOExceptionpublic static short readShort(InputStream inputStream) throws IOException
IOExceptionpublic static short readShort(ByteBuffer buffer)
public static float readFloat(InputStream inputStream) throws IOException
IOExceptionpublic static float readFloat(ByteBuffer byteBuffer)
public static double readDouble(InputStream inputStream) throws IOException
IOExceptionpublic static double readDouble(ByteBuffer byteBuffer)
public static int readInt(InputStream inputStream) throws IOException
IOExceptionpublic static int readInt(ByteBuffer buffer)
public static int read(ByteBuffer buffer)
public static long readLong(InputStream inputStream) throws IOException
IOExceptionpublic static long readLong(ByteBuffer buffer)
public static String readString(InputStream inputStream) throws IOException
IOExceptionpublic static String readVarIntString(InputStream inputStream) throws IOException
IOExceptionpublic static String readString(ByteBuffer buffer)
public static String readVarIntString(ByteBuffer buffer)
public static String readStringWithLength(ByteBuffer buffer, int length)
public static ByteBuffer getByteBuffer(String s)
public static ByteBuffer getByteBuffer(int i)
public static ByteBuffer getByteBuffer(long n)
public static ByteBuffer getByteBuffer(float f)
public static ByteBuffer getByteBuffer(double d)
public static ByteBuffer getByteBuffer(boolean i)
public static String readStringFromDirectByteBuffer(ByteBuffer buffer) throws CharacterCodingException
CharacterCodingExceptionpublic static byte[] readBytes(InputStream inputStream, int length) throws IOException
IOExceptionpublic static Map<String,String> readMap(ByteBuffer buffer)
public static List<Map<String,String>> readMaps(ByteBuffer buffer, int totalSize)
public static byte[] readBytesWithSelfDescriptionLength(InputStream inputStream) throws IOException
IOExceptionpublic static Binary readBinary(ByteBuffer buffer)
public static Binary readBinary(InputStream inputStream) throws IOException
IOExceptionpublic static byte[] readByteBufferWithSelfDescriptionLength(ByteBuffer buffer)
read a int + buffer
public static int readAsPossible(TsFileInput input, long position, ByteBuffer buffer) throws IOException
IOExceptionpublic static int readAsPossible(TsFileInput input, ByteBuffer buffer) throws IOException
IOExceptionpublic static int readAsPossible(TsFileInput input, ByteBuffer target, long offset, int len) throws IOException
IOExceptionpublic static List<String> readStringList(InputStream inputStream) throws IOException
IOExceptionpublic static List<String> readStringList(ByteBuffer buffer)
public static void writeStringList(List<String> list, ByteBuffer buffer)
public static CompressionType readCompressionType(InputStream inputStream) throws IOException
IOExceptionpublic static CompressionType readCompressionType(ByteBuffer buffer)
public static TSDataType readDataType(InputStream inputStream) throws IOException
IOExceptionpublic static TSDataType readDataType(ByteBuffer buffer)
public static TSEncoding readEncoding(InputStream inputStream) throws IOException
IOExceptionpublic static TSEncoding readEncoding(ByteBuffer buffer)
public static boolean checkIfMagicString(ByteBuffer byteBuffer)
byteBuffer - byte bufferpublic static boolean checkIfMagicString(InputStream inputStream) throws IOException
inputStream - inputStreamIOExceptionpublic static void writeObject(Object value, DataOutputStream outputStream)
public static void writeObject(Object value, ByteBuffer byteBuffer)
public static Object readObject(ByteBuffer buffer)
public static ByteBuffer clone(ByteBuffer original)
Copyright © 2022 The Apache Software Foundation. All rights reserved.