|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.btw.commons.StreamUtils
public final class StreamUtils
Utilities for working with streams.
| Method Summary | |
|---|---|
static byte[] |
readByteArray(InputStream in)
Reads the byte array from the input stream. |
static int |
readPackedInt(InputStream in)
Reads the number in a packed format. |
static byte[] |
stringToByteArray(String string)
Writes given string to data output stream as a string. |
static void |
writeByteArray(byte[] bytes,
OutputStream out)
Writes the byte array to the output stream. |
static void |
writePackedInt(int number,
OutputStream out)
Writes the number in a packed format. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void writeByteArray(byte[] bytes,
OutputStream out)
throws IOException
bytes - the bytes to write. Handles null array
correctly.out - writes to this stream.
IOException - if write fails.
public static byte[] readByteArray(InputStream in)
throws IOException
writeByteArray(byte[], OutputStream).
in - reads from this stream.
null if a null array was
written.
IOException - if read fails.
public static void writePackedInt(int number,
OutputStream out)
throws IOException
number - the number to writeout - the output stream.
IOException
public static int readPackedInt(InputStream in)
throws IOException
in - the input stream.
IOExceptionpublic static byte[] stringToByteArray(String string)
String.getBytes(); use
DataInputStream.readUTF() instead.
string - string to convert. Cannot be null.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||