public class DataInputStreamEx extends DataInputStream
DataInputStream
in
Constructor and Description |
---|
DataInputStreamEx(InputStream is)
Creates a new data input stream ex.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
readBytes(int length)
Read exactly the specified number of bytes from the stream.
|
String |
readString(int length)
Read a string of the specified length from the stream.
|
String |
readString0(short length)
Read a null-terminated string of the specified length from the stream.
|
String |
readStringL()
Read a byte length prefixed string from the stream.
|
String |
readStringLL()
Read a short length prefixed string from the stream.
|
String |
readStringNullPadded(int length,
String charset)
Read a null-padded string of length from an input stream.
|
String |
readStringUntilNull(int length)
Read a string from an input stream until a null is reached.
|
read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, readUTF, skipBytes
available, close, mark, markSupported, read, reset, skip
public DataInputStreamEx(InputStream is)
is
- the underlying input streampublic String readString(int length) throws IOException
length
- the lengthIOException
- if an error occurspublic String readString0(short length) throws IOException
length
- the lengthIOException
- if an error occurspublic String readStringL() throws IOException
IOException
- if an error occurspublic String readStringLL() throws IOException
IOException
- if an error occurspublic byte[] readBytes(int length) throws IOException
length
- the lengthIOException
- if an error occurspublic String readStringUntilNull(int length) throws IOException
length
- the maximum length that the string can beIOException
- if an error occurspublic String readStringNullPadded(int length, String charset) throws IOException
length
- the maximum length that the tring can becharset
- the Java charsetIOException
- if an error occurs