public final class StreamUtil extends Object
Modifier and Type | Field and Description |
---|---|
(package private) static byte |
BOOLEAN |
(package private) static byte |
BYTE |
(package private) static byte |
BYTEARRAY |
private static Charset |
charset |
(package private) static byte |
DOUBLE |
(package private) static byte[] |
EMPTY_BYTE_ARRAY |
(package private) static String |
EMPTY_STRING |
static int |
FALSE |
(package private) static byte |
FLOAT |
(package private) static byte |
INT |
(package private) static Logger |
logger |
(package private) static byte |
LONG |
(package private) static byte |
NULL |
private static ThreadLocal |
perThreadBuffer |
(package private) static byte |
SHORT |
static String |
STREAM_CHARSET_DFLT |
static String |
STREAM_CHARSET_PROPERTY |
static String |
STREAM_USE_JVM_CHARSET_PROPERTY |
(package private) static byte |
STRING |
static int |
TRUE |
Constructor and Description |
---|
StreamUtil() |
Modifier and Type | Method and Description |
---|---|
static Object |
decodeValue(Decoder decoder) |
static void |
encodeValue(Object obj,
Encoder encoder) |
static int |
getEncodedSize(Object obj) |
static boolean |
isStreamable(Object obj)
Test if an object is writable to an output stream.
|
static ArrayList<String> |
readArrayListOfStringFrom(InputStream is)
This method allows to restore a list of String objects from the input stream.
|
static boolean[] |
readArrayOfBooleanFrom(InputStream is)
This method allows to restore a boolean array from the input stream.
|
static int[] |
readArrayOfIntFrom(InputStream is)
This method allows to restore a int array from the input stream.
|
static String[] |
readArrayOfStringFrom(InputStream is)
This method allows to restore a String array from the input stream.
|
static boolean |
readBooleanFrom(InputStream is)
This method allows to restore a boolean from the input stream.
|
static byte[] |
readByteArrayFrom(InputStream is)
This method allows to restore a byte array from the input stream.
|
static byte[] |
readByteArrayFrom(InputStream is,
int length)
This method allows to restore a byte array from the input stream.
|
static byte |
readByteFrom(InputStream is)
This method allows to restore a byte from the input stream.
|
static double |
readDoubleFrom(InputStream is)
This method allows to restore a double from the input stream.
|
static float |
readFloatFrom(InputStream is)
This method allows to restore a float from the input stream.
|
private static void |
readFully(byte[] buf,
InputStream is) |
private static byte[] |
readFully(int length,
InputStream is) |
static int |
readIntFrom(InputStream is)
This method allows to restore an integer from the input stream.
|
static Properties |
readJPropertiesFrom(InputStream is)
This method allows to restore a java.util.Properties object from the input stream.
|
static long |
readLongFrom(InputStream is)
This method allows to restore a long from the input stream.
|
static Object |
readObjectFrom(InputStream is)
This method allows to restore an object from the input stream.
|
static Properties |
readPropertiesFrom(InputStream is)
This method allows to restore a Properties object from the input stream.
|
static short |
readShortFrom(InputStream is)
This method allows to restore a short from the input stream.
|
static String |
readShortStringFrom(InputStream is)
This method allows to restore a short String from the input stream.
|
static String |
readStringFrom(InputStream is)
This method allows to restore a String from the input stream
|
static int |
readUnsignedByteFrom(InputStream is)
This method allows to restore a byte from the input stream.
|
static long |
readUnsignedIntFrom(InputStream is)
This method allows to restore an integer from the input stream.
|
static Vector<String> |
readVectorOfStringFrom(InputStream is)
This method allows to restore a vector of String objects from the input stream.
|
static void |
writeArrayOfBooleanTo(boolean[] array,
OutputStream os)
This method allows to write a boolean array to the output stream.
|
static void |
writeArrayOfIntTo(int[] array,
OutputStream os)
This method allows to write a int array to the output stream.
|
static void |
writeArrayOfStringTo(String[] array,
OutputStream os)
This method allows to write a String array to the output stream.
|
static void |
writeListOfStringTo(List v,
OutputStream os)
This method allows to write a generic list of String objects to the output stream.
|
static void |
writeObjectTo(Object obj,
OutputStream os)
This method allows to write an object to the output stream.
|
static void |
writeTo(boolean b,
OutputStream os)
This method allows to write a boolean to the output stream.
|
static void |
writeTo(byte[] tab,
int offset,
int length,
OutputStream os)
This method allows to write byte array to the output stream.
|
static void |
writeTo(byte[] tab,
OutputStream os)
This method allows to write byte array to the output stream.
|
static void |
writeTo(byte b,
OutputStream os)
This method allows to write a byte to the output stream.
|
static void |
writeTo(double d,
OutputStream os)
This method allows to write a double to the output stream.
|
static void |
writeTo(float f,
OutputStream os)
This method allows to write a float to the output stream.
|
static void |
writeTo(int i,
OutputStream os)
This method allows to write an integer to the output stream.
|
static void |
writeTo(long l,
OutputStream os)
This method allows to write a long to the output stream.
|
static void |
writeTo(Properties p,
OutputStream os)
This method allows to write a Properties object to the output stream.
|
static void |
writeTo(Properties p,
OutputStream os)
This method allows to write a java.util.Properties object to the output stream.
|
static void |
writeTo(short s,
OutputStream os)
This method allows to write a short to the output stream.
|
static void |
writeTo(String str,
OutputStream os)
This method allows to write a String to the output stream
|
static Logger logger
public static final String STREAM_CHARSET_PROPERTY
public static final String STREAM_USE_JVM_CHARSET_PROPERTY
public static final String STREAM_CHARSET_DFLT
private static final Charset charset
private static ThreadLocal perThreadBuffer
public static final int TRUE
public static final int FALSE
static final String EMPTY_STRING
static final byte[] EMPTY_BYTE_ARRAY
static final byte NULL
static final byte BOOLEAN
static final byte BYTE
static final byte SHORT
static final byte INT
static final byte LONG
static final byte FLOAT
static final byte DOUBLE
static final byte STRING
static final byte BYTEARRAY
private static byte[] readFully(int length, InputStream is) throws IOException
IOException
private static void readFully(byte[] buf, InputStream is) throws IOException
IOException
public static void writeTo(boolean b, OutputStream os) throws IOException
b
- the boolean to writeos
- the stream to write the object toIOException
- an error occurs during IO operation.public static boolean readBooleanFrom(InputStream is) throws IOException
is
- the stream to read data from in order to restore the objectIOException
- an error occurs during IO operation.public static void writeTo(byte b, OutputStream os) throws IOException
b
- the byte to writeos
- the stream to write the object toIOException
- an error occurs during IO operation.public static byte readByteFrom(InputStream is) throws IOException
is
- the stream to read data from in order to restore the objectIOException
- an error occurs during IO operation.public static int readUnsignedByteFrom(InputStream is) throws IOException
is
- the stream to read data from in order to restore the objectIOException
- an error occurs during IO operation.public static void writeTo(short s, OutputStream os) throws IOException
s
- the short to writeos
- the stream to write the object toIOException
- an error occurs during IO operation.public static short readShortFrom(InputStream is) throws IOException
is
- the stream to read data from in order to restore the objectIOException
- an error occurs during IO operation.public static void writeTo(int i, OutputStream os) throws IOException
i
- the integer to writeos
- the stream to write the object toIOException
- an error occurs during IO operation.public static int readIntFrom(InputStream is) throws IOException
is
- the stream to read data from in order to restore the objectIOException
- an error occurs during IO operation.public static long readUnsignedIntFrom(InputStream is) throws IOException
is
- the stream to read data from in order to restore the objectIOException
- an error occurs during IO operation.public static void writeTo(long l, OutputStream os) throws IOException
l
- the long to writeos
- the stream to write the object toIOException
- an error occurs during IO operation.public static long readLongFrom(InputStream is) throws IOException
is
- the stream to read data from in order to restore the objectIOException
- an error occurs during IO operation.public static void writeTo(float f, OutputStream os) throws IOException
f
- the float to writeos
- the stream to write the object toIOException
- an error occurs during IO operation.public static float readFloatFrom(InputStream is) throws IOException
is
- the stream to read data from in order to restore the objectIOException
- an error occurs during IO operation.public static void writeTo(double d, OutputStream os) throws IOException
d
- the double to writeos
- the stream to write the object toIOException
- an error occurs during IO operation.public static double readDoubleFrom(InputStream is) throws IOException
is
- the stream to read data from in order to restore the objectIOException
- an error occurs during IO operation.public static void writeTo(String str, OutputStream os) throws IOException
str
- the String to writeos
- the stream to write the object toIOException
- an error occurs during IO operation.public static String readStringFrom(InputStream is) throws IOException
is
- the stream to read data from in order to restore the objectIOException
- an error occurs during IO operation.public static String readShortStringFrom(InputStream is) throws IOException
is
- the stream to read data from in order to restore the objectIOException
- an error occurs during IO operation.public static void writeTo(byte[] tab, OutputStream os) throws IOException
tab
- the byte array to writeos
- the stream to write the object toIOException
- an error occurs during IO operation.public static void writeTo(byte[] tab, int offset, int length, OutputStream os) throws IOException
tab
- the byte array to writeoffset
- the starting offset of the subarray.length
- the length of the subarray.os
- the stream to write the object toIOException
- an error occurs during IO operation.public static byte[] readByteArrayFrom(InputStream is) throws IOException
is
- the stream to read data from in order to restore the objectIOException
- an error occurs during IO operation.public static byte[] readByteArrayFrom(InputStream is, int length) throws IOException
is
- the stream to read data from in order to restore the objectlength
- the length of bytes to readIOException
- an error occurs during IO operation.public static boolean isStreamable(Object obj)
obj
- the object to writepublic static void writeObjectTo(Object obj, OutputStream os) throws IOException
obj
- the object to writeos
- the stream to write the object toIOException
- an error occurs during IO operation.public static Object readObjectFrom(InputStream is) throws IOException
is
- the stream to read data from in order to restore the objectIOException
- an error occurs during IO operation.public static void writeTo(Properties p, OutputStream os) throws IOException
p
- the Properties object to writeos
- the stream to write the object toIOException
- an error occurs during IO operation.public static Properties readPropertiesFrom(InputStream is) throws IOException
is
- the stream to read data from in order to restore the objectIOException
- an error occurs during IO operation.public static void writeListOfStringTo(List v, OutputStream os) throws IOException
v
- the List object to writeos
- the stream to write the object toIOException
- an error occurs during IO operation.public static Vector<String> readVectorOfStringFrom(InputStream is) throws IOException
is
- the stream to read data from in order to restore the objectIOException
- an error occurs during IO operation.public static ArrayList<String> readArrayListOfStringFrom(InputStream is) throws IOException
is
- the stream to read data from in order to restore the objectIOException
- an error occurs during IO operation.public static void writeArrayOfStringTo(String[] array, OutputStream os) throws IOException
array
- the String array to writeos
- the stream to write toIOException
- an error occurs during IO operation.public static String[] readArrayOfStringFrom(InputStream is) throws IOException
is
- the stream to read data from in order to restore the String arrayIOException
- an error occurs during IO operation.public static void writeArrayOfIntTo(int[] array, OutputStream os) throws IOException
array
- the int array to writeos
- the stream to write toIOException
- an error occurs during IO operation.public static int[] readArrayOfIntFrom(InputStream is) throws IOException
is
- the stream to read data from in order to restore the int arrayIOException
- an error occurs during IO operation.public static void writeArrayOfBooleanTo(boolean[] array, OutputStream os) throws IOException
array
- the boolean array to writeos
- the stream to write toIOException
- an error occurs during IO operation.public static boolean[] readArrayOfBooleanFrom(InputStream is) throws IOException
is
- the stream to read data from in order to restore the boolean arrayIOException
- an error occurs during IO operation.public static void writeTo(Properties p, OutputStream os) throws IOException
p
- the java.util.Properties object to writeos
- the stream to write the object toIOException
- an error occurs during IO operation.public static Properties readJPropertiesFrom(InputStream is) throws IOException
is
- the stream to read data from in order to restore the objectIOException
- an error occurs during IO operation.public static int getEncodedSize(Object obj) throws IOException
IOException
public static void encodeValue(Object obj, Encoder encoder) throws Exception
Exception
Copyright © 2022 ScalAgent D.T.. All rights reserved.