public class IOUtils extends Object
Constructor and Description |
---|
IOUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
byteRangeMatches(byte[] wanted,
byte[] within,
int withinOffset)
Checks to see if the wanted byte pattern is found in the
within bytes from the given offset
|
static byte |
fromInt(int i) |
static int |
getInt(int i0,
int i1) |
static long |
getInt(int i0,
int i1,
int i2) |
static long |
getInt(int i0,
int i1,
int i2,
int i3) |
static long |
getInt(int i0,
int i1,
int i2,
int i3,
int i4) |
static long |
getInt(int i0,
int i1,
int i2,
int i3,
int i4,
int i5,
int i6,
int i7) |
static int |
getInt2(byte[] data) |
static int |
getInt2(byte[] data,
int offset) |
static int |
getInt2BE(byte[] data) |
static int |
getInt2BE(byte[] data,
int offset) |
static long |
getInt3(byte[] data) |
static long |
getInt3(byte[] data,
int offset) |
static long |
getInt3BE(byte[] data) |
static long |
getInt3BE(byte[] data,
int offset) |
static long |
getInt4(byte[] data) |
static long |
getInt4(byte[] data,
int offset) |
static long |
getInt4BE(byte[] data) |
static long |
getInt4BE(byte[] data,
int offset) |
static long |
getInt5(byte[] data) |
static long |
getInt5(byte[] data,
int offset) |
static long |
getInt8(byte[] data) |
static long |
getInt8(byte[] data,
int offset) |
static int |
getIntBE(int i0,
int i1) |
static long |
getIntBE(int i0,
int i1,
int i2) |
static long |
getIntBE(int i0,
int i1,
int i2,
int i3) |
static String |
getUTF8(byte[] data,
int offset,
int length) |
static void |
putInt2(byte[] data,
int offset,
int v) |
static void |
putInt2BE(byte[] data,
int offset,
int v) |
static void |
putInt3(byte[] data,
int offset,
long v) |
static void |
putInt3BE(byte[] data,
int offset,
long v) |
static void |
putInt4(byte[] data,
int offset,
long v) |
static void |
putInt4BE(byte[] data,
int offset,
long v) |
static void |
putInt5(byte[] data,
int offset,
long v) |
static void |
putInt8(byte[] data,
int offset,
long v) |
static int |
putUTF8(byte[] data,
int offset,
String str) |
static void |
readFully(InputStream inp,
byte[] destination) |
static void |
readFully(InputStream inp,
byte[] destination,
int offset,
int length) |
static String |
removeNullPadding(String str)
Strips off any null padding, if any, from the string
|
static int |
toInt(byte b) |
static byte[] |
toUTF8Bytes(String str) |
static void |
writeInt2(OutputStream out,
int v) |
static void |
writeInt2BE(OutputStream out,
int v) |
static void |
writeInt3(OutputStream out,
long v) |
static void |
writeInt3BE(OutputStream out,
long v) |
static void |
writeInt4(OutputStream out,
long v) |
static void |
writeInt4BE(OutputStream out,
long v) |
static void |
writeInt5(OutputStream out,
long v) |
static void |
writeInt8(OutputStream out,
long v) |
static void |
writeUTF8(OutputStream out,
String str)
Writes the string out as UTF-8
|
static void |
writeUTF8WithLength(OutputStream out,
String str)
Writes out a 4 byte integer of the length (in bytes!) of the
String, followed by the String (as UTF-8)
|
protected static final Charset UTF8
public static void readFully(InputStream inp, byte[] destination) throws IOException
IOException
public static void readFully(InputStream inp, byte[] destination, int offset, int length) throws IOException
IOException
public static int toInt(byte b)
public static byte fromInt(int i)
public static int getInt2(byte[] data)
public static int getInt2(byte[] data, int offset)
public static long getInt3(byte[] data)
public static long getInt3(byte[] data, int offset)
public static long getInt4(byte[] data)
public static long getInt4(byte[] data, int offset)
public static long getInt5(byte[] data)
public static long getInt5(byte[] data, int offset)
public static long getInt8(byte[] data)
public static long getInt8(byte[] data, int offset)
public static int getInt(int i0, int i1)
public static long getInt(int i0, int i1, int i2)
public static long getInt(int i0, int i1, int i2, int i3)
public static long getInt(int i0, int i1, int i2, int i3, int i4)
public static long getInt(int i0, int i1, int i2, int i3, int i4, int i5, int i6, int i7)
public static int getInt2BE(byte[] data)
public static int getInt2BE(byte[] data, int offset)
public static long getInt3BE(byte[] data)
public static long getInt3BE(byte[] data, int offset)
public static long getInt4BE(byte[] data)
public static long getInt4BE(byte[] data, int offset)
public static int getIntBE(int i0, int i1)
public static long getIntBE(int i0, int i1, int i2)
public static long getIntBE(int i0, int i1, int i2, int i3)
public static void writeInt2(OutputStream out, int v) throws IOException
IOException
public static void putInt2(byte[] data, int offset, int v)
public static void writeInt3(OutputStream out, long v) throws IOException
IOException
public static void putInt3(byte[] data, int offset, long v)
public static void writeInt4(OutputStream out, long v) throws IOException
IOException
public static void putInt4(byte[] data, int offset, long v)
public static void writeInt5(OutputStream out, long v) throws IOException
IOException
public static void putInt5(byte[] data, int offset, long v)
public static void writeInt8(OutputStream out, long v) throws IOException
IOException
public static void putInt8(byte[] data, int offset, long v)
public static void writeInt2BE(OutputStream out, int v) throws IOException
IOException
public static void putInt2BE(byte[] data, int offset, int v)
public static void writeInt3BE(OutputStream out, long v) throws IOException
IOException
public static void putInt3BE(byte[] data, int offset, long v)
public static void writeInt4BE(OutputStream out, long v) throws IOException
IOException
public static void putInt4BE(byte[] data, int offset, long v)
public static String getUTF8(byte[] data, int offset, int length)
length
- The length in BYTESpublic static String removeNullPadding(String str)
public static int putUTF8(byte[] data, int offset, String str)
public static byte[] toUTF8Bytes(String str)
public static void writeUTF8(OutputStream out, String str) throws IOException
IOException
public static void writeUTF8WithLength(OutputStream out, String str) throws IOException
IOException
public static boolean byteRangeMatches(byte[] wanted, byte[] within, int withinOffset)
wanted
- Byte sequence to look forwithin
- Bytes to find inwithinOffset
- Offset to check fromCopyright © 2015. All rights reserved.