public class ByteOp extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
BUFFER_SIZE
Default buffer size for IO ops
|
static Charset |
UTF8 |
| Constructor and Description |
|---|
ByteOp() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
cmp(byte[] a,
byte[] b)
Compare two byte arrays
|
static byte[] |
copy(byte[] src,
int offset,
int length)
Create a new byte array with contents initialized to values from the
argument byte array.
|
static void |
copyStream(InputStream is,
OutputStream os)
Write all bytes from is to os.
|
static void |
copyStream(InputStream is,
OutputStream os,
int size)
Write all bytes from is to os.
|
static void |
discardStream(InputStream is)
throw away all bytes from stream argument
|
static void |
discardStream(InputStream is,
int size)
throw away all bytes from stream argument
|
static long |
discardStreamCount(InputStream is)
throw away all bytes from stream argument, and count how many bytes were
discarded before reaching the end of the stream.
|
static long |
discardStreamCount(InputStream is,
int size)
throw away all bytes from stream argument, and count how many bytes were
discarded before reaching the end of the stream.
|
public static final int BUFFER_SIZE
public static final Charset UTF8
public static byte[] copy(byte[] src,
int offset,
int length)
src - source byte array of initial valuesoffset - start offset to copy byteslength - number of bytes to copypublic static boolean cmp(byte[] a,
byte[] b)
a - byte array to compareb - byte array to comparepublic static void discardStream(InputStream is) throws IOException
is - InputStream to read and discardIOException - when is throws onepublic static void discardStream(InputStream is, int size) throws IOException
is - InputStream to read and discardsize - number of bytes to read at once from the streamIOException - when is throws onepublic static long discardStreamCount(InputStream is) throws IOException
is - InputStream to read and discardIOException - when is throws onepublic static long discardStreamCount(InputStream is, int size) throws IOException
is - InputStream to read and discardsize - number of bytes to read at once from the streamIOException - when is throws onepublic static void copyStream(InputStream is, OutputStream os) throws IOException
is - to copy bytes fromos - to copy bytes toIOException - for usual reasonspublic static void copyStream(InputStream is, OutputStream os, int size) throws IOException
is - to copy bytes fromos - to copy bytes tosize - number of bytes to buffer between read and write operationsIOException - for usual reasonsCopyright © 2005–2017 IIPC. All rights reserved.