public class ByteOp
extends java.lang.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(java.io.InputStream is) |
static java.lang.String |
drawHex(byte[] b) |
static java.lang.String |
drawHex(byte[] b,
int bytesPerRow) |
static java.lang.String |
drawHex(byte[] b,
int offset,
int length,
int bytesPerRow) |
byte[] |
readFile(java.io.File f) |
static long |
readInt(java.io.DataInput in) |
static long |
readInt(java.io.InputStream is) |
static byte[] |
readNBytes(java.io.InputStream is,
int n) |
static int |
readShort(java.io.DataInput in) |
static int |
readShort(java.io.InputStream is) |
static byte[] |
readToNull(java.io.InputStream is)
Read, buffer, and return bytes from is until a null byte is encountered
|
static byte[] |
readToNull(java.io.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(java.io.OutputStream os,
long intVal) |
static void |
writeShort(byte[] buf,
int offset,
int shortVal) |
static void |
writeShort(java.io.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(java.io.DataInput in)
throws java.io.IOException
java.io.IOExceptionpublic static int readShort(java.io.InputStream is)
throws java.io.IOException
java.io.IOExceptionpublic static void writeShort(java.io.OutputStream os,
int shortVal)
throws java.io.IOException
java.io.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(java.io.DataInput in)
throws java.io.IOException
java.io.IOExceptionpublic static long readInt(java.io.InputStream is)
throws java.io.IOException
java.io.IOExceptionpublic static void writeInt(java.io.OutputStream os,
long intVal)
throws java.io.IOException
java.io.IOExceptionpublic static void writeInt(byte[] buf,
int offset,
long intVal)
public static byte[] readNBytes(java.io.InputStream is,
int n)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] readToNull(java.io.InputStream is)
throws java.io.IOException
is - InputStream to read fromjava.io.IOException - 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(java.io.InputStream is,
int maxSize)
throws java.io.IOException
is - InputStream to read frommaxSize - maximum number of bytes to search for the nulljava.io.IOException - 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(java.io.InputStream is)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String drawHex(byte[] b)
public static java.lang.String drawHex(byte[] b,
int bytesPerRow)
public static java.lang.String drawHex(byte[] b,
int offset,
int length,
int bytesPerRow)
public byte[] readFile(java.io.File f)
throws java.io.FileNotFoundException,
java.io.IOException
java.io.FileNotFoundExceptionjava.io.IOExceptionCopyright © 2019 The International Internet Preservation Consortium. All Rights Reserved.