Package org.gittorr.ccerial.utils
Class BinaryUtils
java.lang.Object
org.gittorr.ccerial.utils.BinaryUtils
Binary utilities class.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic WriterFunction<String>createStringWriter(String charset) static booleanisNullOrEmpty(byte[] ar) static booleanisNullOrEmpty(char[] ar) static booleanisNullOrEmpty(double[] ar) static booleanisNullOrEmpty(float[] ar) static booleanisNullOrEmpty(int[] ar) static booleanisNullOrEmpty(long[] ar) static booleanisNullOrEmpty(short[] ar) static <T> booleanstatic <T> booleanisNullOrEmpty(Collection<T> ar) static <K,V> boolean isNullOrEmpty(Map<K, V> map) static <T> booleanisNullOrEmpty(T[] ar) static booleanstatic bytereadByte(InputStream in) static byte[]readBytes(InputStream in) static byte[]readBytes(InputStream in, int count) static charreadChar(InputStream in) static char[]readChars(InputStream in) static char[]readChars(InputStream in, int count) static <T> Collection<T>readCollection(InputStream in, int count, ReaderFunction<T> componentReader, Function<Integer, Collection<T>> creator) static <T> Collection<T>readCollection(InputStream in, ReaderFunction<T> componentReader, Function<Integer, Collection<T>> creator) static doublestatic double[]static double[]readDoubles(InputStream in, int count) static floatreadFloat(InputStream in) static float[]static float[]readFloats(InputStream in, int count) static <T> T[]readGenericArray(InputStream in, int count, ReaderFunction<T> componentReader, Function<Integer, T[]> creator) static <T> T[]readGenericArray(InputStream in, ReaderFunction<T> componentReader, Function<Integer, T[]> creator) static intreadInt(InputStream in) static int[]readInts(InputStream in) static int[]readInts(InputStream in, int count) static longreadLong(InputStream in) static long[]readLongs(InputStream in) static long[]readLongs(InputStream in, int count) static <T> TreadObject(InputStream in, Class<T> type) static shortreadShort(InputStream in) static StringreadString(InputStream in, int count, String charsetName) static StringreadString(InputStream in, String charsetName) static doublestatic floatstatic intstatic longstatic voidwriteBoolean(OutputStream out, boolean b) static voidwriteByte(OutputStream out, byte b) static voidwriteBytes(OutputStream out, byte[] bytes) static voidwriteBytes(OutputStream out, byte[] bytes, int count) static voidwriteChar(OutputStream out, char s) static voidwriteChars(OutputStream out, char[] chars) static voidwriteChars(OutputStream out, char[] chars, int count) static <T> voidwriteCollection(OutputStream out, Collection<T> ar, int count, WriterFunction<T> componentWriter) static <T> voidwriteCollection(OutputStream out, Collection<T> ar, WriterFunction<T> componentWriter) static voidwriteDouble(OutputStream out, double value) static voidwriteDoubles(OutputStream out, double[] ds) static voidwriteDoubles(OutputStream out, double[] ds, int count) static voidwriteFloat(OutputStream out, float value) static voidwriteFloats(OutputStream out, float[] fs) static voidwriteFloats(OutputStream out, float[] fs, int count) static <T> voidwriteGenericArray(OutputStream out, T[] ar, int count, WriterFunction<T> componentWriter) static <T> voidwriteGenericArray(OutputStream out, T[] ar, WriterFunction<T> componentWriter) static voidwriteInt(OutputStream out, int i) static voidwriteInts(OutputStream out, int[] is) static voidwriteInts(OutputStream out, int[] is, int count) static voidwriteLong(OutputStream out, long l) static voidwriteLongs(OutputStream out, long[] ls) static voidwriteLongs(OutputStream out, long[] ls, int count) static voidwriteObject(OutputStream out, Object obj) static voidwriteShort(OutputStream out, short s) static voidwriteString(OutputStream out, String s, int count, String charsetName) static voidwriteString(OutputStream out, String s, String charsetName) static voidwriteVarDouble(OutputStream out, double value) static voidwriteVarFloat(OutputStream out, float value) static voidwriteVarInt(OutputStream out, int value) static voidwriteVarLong(OutputStream out, long value) static BytezeroIfNull(Byte i) static DoublezeroIfNull(Double i) static FloatzeroIfNull(Float i) static Integerstatic LongzeroIfNull(Long i) static ShortzeroIfNull(Short i)
-
Constructor Details
-
BinaryUtils
public BinaryUtils()
-
-
Method Details
-
zeroIfNull
-
zeroIfNull
-
zeroIfNull
-
zeroIfNull
-
zeroIfNull
-
zeroIfNull
-
isNullOrEmpty
public static boolean isNullOrEmpty(byte[] ar) -
isNullOrEmpty
public static boolean isNullOrEmpty(char[] ar) -
isNullOrEmpty
public static boolean isNullOrEmpty(int[] ar) -
isNullOrEmpty
public static boolean isNullOrEmpty(short[] ar) -
isNullOrEmpty
public static boolean isNullOrEmpty(long[] ar) -
isNullOrEmpty
public static boolean isNullOrEmpty(float[] ar) -
isNullOrEmpty
public static boolean isNullOrEmpty(double[] ar) -
isNullOrEmpty
public static <T> boolean isNullOrEmpty(T[] ar) -
isNullOrEmpty
-
isNullOrEmpty
-
isNullOrEmpty
-
writeCollection
public static <T> void writeCollection(OutputStream out, Collection<T> ar, WriterFunction<T> componentWriter) throws IOException - Throws:
IOException
-
writeCollection
public static <T> void writeCollection(OutputStream out, Collection<T> ar, int count, WriterFunction<T> componentWriter) throws IOException - Throws:
IOException
-
readCollection
public static <T> Collection<T> readCollection(InputStream in, ReaderFunction<T> componentReader, Function<Integer, Collection<T>> creator) throws IOException- Throws:
IOException
-
readCollection
public static <T> Collection<T> readCollection(InputStream in, int count, ReaderFunction<T> componentReader, Function<Integer, Collection<T>> creator) throws IOException- Throws:
IOException
-
writeGenericArray
public static <T> void writeGenericArray(OutputStream out, T[] ar, WriterFunction<T> componentWriter) throws IOException - Throws:
IOException
-
readGenericArray
public static <T> T[] readGenericArray(InputStream in, ReaderFunction<T> componentReader, Function<Integer, T[]> creator) throws IOException- Throws:
IOException
-
writeGenericArray
public static <T> void writeGenericArray(OutputStream out, T[] ar, int count, WriterFunction<T> componentWriter) throws IOException - Throws:
IOException
-
readGenericArray
public static <T> T[] readGenericArray(InputStream in, int count, ReaderFunction<T> componentReader, Function<Integer, T[]> creator) throws IOException- Throws:
IOException
-
writeObject
- Throws:
IOException
-
readObject
- Throws:
IOException
-
writeFloats
- Throws:
IOException
-
writeFloats
- Throws:
IOException
-
readFloats
- Throws:
IOException
-
readFloats
- Throws:
IOException
-
writeDoubles
- Throws:
IOException
-
writeDoubles
- Throws:
IOException
-
readDoubles
- Throws:
IOException
-
readDoubles
- Throws:
IOException
-
writeChars
- Throws:
IOException
-
writeChars
- Throws:
IOException
-
readChars
- Throws:
IOException
-
readChars
- Throws:
IOException
-
writeInts
- Throws:
IOException
-
writeInts
- Throws:
IOException
-
readInts
- Throws:
IOException
-
readInts
- Throws:
IOException
-
writeLongs
- Throws:
IOException
-
writeLongs
- Throws:
IOException
-
readLongs
- Throws:
IOException
-
readLongs
- Throws:
IOException
-
writeString
- Throws:
IOException
-
writeString
public static void writeString(OutputStream out, String s, int count, String charsetName) throws IOException - Throws:
IOException
-
createStringWriter
-
readString
- Throws:
IOException
-
readString
- Throws:
IOException
-
writeBytes
- Throws:
IOException
-
writeBytes
- Throws:
IOException
-
readBytes
- Throws:
IOException
-
readBytes
- Throws:
IOException
-
writeByte
- Throws:
IOException
-
readByte
- Throws:
IOException
-
writeBoolean
- Throws:
IOException
-
readBoolean
- Throws:
IOException
-
writeShort
- Throws:
IOException
-
readShort
- Throws:
IOException
-
writeChar
- Throws:
IOException
-
readChar
- Throws:
IOException
-
writeVarFloat
- Throws:
IOException
-
writeFloat
- Throws:
IOException
-
writeVarInt
- Throws:
IOException
-
writeInt
- Throws:
IOException
-
writeVarDouble
- Throws:
IOException
-
writeDouble
- Throws:
IOException
-
writeVarLong
- Throws:
IOException
-
writeLong
- Throws:
IOException
-
readVarInt
- Throws:
IOException
-
readInt
- Throws:
IOException
-
readVarFloat
- Throws:
IOException
-
readFloat
- Throws:
IOException
-
readVarLong
- Throws:
IOException
-
readLong
- Throws:
IOException
-
readVarDouble
- Throws:
IOException
-
readDouble
- Throws:
IOException
-