Methods Summary |
---|
private int | __read()
int ch;
ch = super.read();
if (ch == '\r")
{
ch = super.read();
if (ch == '\n")
{
unread(_lineSeparatorBytes);
ch = super.read();
// This is a kluge for read(byte[], ...) to read the right amount
--__length;
}
else
{
if (ch != -1)
unread(ch);
return '\r";
}
}
return ch;
|
public int | available()Returns the number of bytes that can be read without blocking EXCEPT
when newline conversions have to be made somewhere within the
available block of bytes. In other words, you really should not
rely on the value returned by this method if you are trying to avoid
blocking.
return (buf.length - pos) + in.available();
|
public static final boolean | isConversionRequired()Returns true if the NetASCII line separator differs from the system
line separator, false if they are the same. This method is useful
to determine whether or not you need to instantiate a
FromNetASCIIInputStream object.
return !_noConversionRequired;
|
public int | read()Reads and returns the next byte in the stream. If the end of the
message has been reached, returns -1. Note that a call to this method
may result in multiple reads from the underlying input stream in order
to convert NETASCII line separators to the local line separator format.
This is transparent to the programmer and is only mentioned for
completeness.
if (_noConversionRequired)
return super.read();
return __read();
|
public int | read(byte[] buffer)Reads the next number of bytes from the stream into an array and
returns the number of bytes read. Returns -1 if the end of the
stream has been reached.
return read(buffer, 0, buffer.length);
|
public int | read(byte[] buffer, int offset, int length)Reads the next number of bytes from the stream into an array and returns
the number of bytes read. Returns -1 if the end of the
message has been reached. The characters are stored in the array
starting from the given offset and up to the length specified.
int ch, off;
if (length < 1)
return 0;
ch = available();
__length = (length > ch ? ch : length);
// If nothing is available, block to read only one character
if (__length < 1)
__length = 1;
if (_noConversionRequired)
return super.read(buffer, offset, __length);
if ((ch = __read()) == -1)
return -1;
off = offset;
do
{
buffer[offset++] = (byte)ch;
}
while (--__length > 0 && (ch = __read()) != -1);
return (offset - off);
|