public class ByteOp extends Object
| Constructor and Description |
|---|
ByteOp() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
append(byte[] a,
byte[] b) |
static long |
bytesToInt(byte[] bytes) |
static long |
bytesToInt(byte[] bytes,
int offset) |
static long |
bytesToInt(int b1,
int b2,
int b3,
int b4) |
static int |
bytesToShort(byte[] bytes) |
static int |
bytesToShort(byte[] bytes,
int offset) |
static int |
bytesToShort(int b1,
int b2) |
static boolean |
cmp(byte[] input,
byte[] want) |
static boolean |
cmp(byte[] b1,
int src1,
byte[] b2,
int src2,
int n) |
static byte[] |
copy(byte[] src) |
static byte[] |
copy(byte[] src,
int offset,
int length) |
static int |
discardToNull(InputStream is) |
static String |
drawHex(byte[] b) |
static String |
drawHex(byte[] b,
int bytesPerRow) |
static String |
drawHex(byte[] b,
int offset,
int length,
int bytesPerRow) |
byte[] |
readFile(File f) |
static long |
readInt(DataInput in) |
static long |
readInt(InputStream is) |
static byte[] |
readNBytes(InputStream is,
int n) |
static int |
readShort(DataInput in) |
static int |
readShort(InputStream is) |
static byte[] |
readToNull(InputStream is)
Read, buffer, and return bytes from is until a null byte is encountered
|
static byte[] |
readToNull(InputStream is,
int maxSize)
Read, buffer, and return bytes from is until a null byte is encountered
|
static void |
writeInt(byte[] buf,
int offset,
long intVal) |
static void |
writeInt(OutputStream os,
long intVal) |
static void |
writeShort(byte[] buf,
int offset,
int shortVal) |
static void |
writeShort(OutputStream os,
int shortVal) |
public static byte[] copy(byte[] src)
public static byte[] copy(byte[] src,
int offset,
int length)
public static boolean cmp(byte[] input,
byte[] want)
public static boolean cmp(byte[] b1,
int src1,
byte[] b2,
int src2,
int n)
public static byte[] append(byte[] a,
byte[] b)
public static int bytesToShort(int b1,
int b2)
public static int bytesToShort(byte[] bytes,
int offset)
public static int bytesToShort(byte[] bytes)
public static int readShort(DataInput in) throws IOException
IOExceptionpublic static int readShort(InputStream is) throws IOException
IOExceptionpublic static void writeShort(OutputStream os, int shortVal) throws IOException
IOExceptionpublic static void writeShort(byte[] buf,
int offset,
int shortVal)
public static long bytesToInt(int b1,
int b2,
int b3,
int b4)
public static long bytesToInt(byte[] bytes,
int offset)
public static long bytesToInt(byte[] bytes)
public static long readInt(DataInput in) throws IOException
IOExceptionpublic static long readInt(InputStream is) throws IOException
IOExceptionpublic static void writeInt(OutputStream os, long intVal) throws IOException
IOExceptionpublic static void writeInt(byte[] buf,
int offset,
long intVal)
public static byte[] readNBytes(InputStream is, int n) throws IOException
IOExceptionpublic static byte[] readToNull(InputStream is) throws IOException
is - InputStream to read fromIOException - if the underlying stream throws on, OR if the default
maximum buffer size is reached before a null byte is foundShortByteReadException - if EOF is encountered before a null bytepublic static byte[] readToNull(InputStream is, int maxSize) throws IOException
is - InputStream to read frommaxSize - maximum number of bytes to search for the nullIOException - if the underlying stream throws on, OR if the
specified maximum buffer size is reached before a null byte is foundShortByteReadException - if EOF is encountered before a null bytepublic static int discardToNull(InputStream is) throws IOException
IOExceptionpublic static String drawHex(byte[] b)
public static String drawHex(byte[] b, int bytesPerRow)
public static String drawHex(byte[] b, int offset, int length, int bytesPerRow)
public byte[] readFile(File f) throws FileNotFoundException, IOException
FileNotFoundExceptionIOExceptionCopyright © 2015 The International Internet Preservation Consortium. All Rights Reserved.