Methods Summary |
---|
public int | available()
int result;
result = in.available();
if (__status == __LAST_WAS_NL)
return (result + 1);
return result;
|
public boolean | markSupported()Returns false. Mark is not supported.
return false;
|
public int | read()Reads and returns the next byte in the stream. If the end of the
message has been reached, returns -1.
int ch;
if (__status == __LAST_WAS_NL)
{
__status = __NOTHING_SPECIAL;
return '\n";
}
ch = in.read();
switch (ch)
{
case '\r":
__status = __LAST_WAS_CR;
return '\r";
case '\n":
if (__status != __LAST_WAS_CR)
{
__status = __LAST_WAS_NL;
return '\r";
}
// else fall through
default:
__status = __NOTHING_SPECIAL;
return ch;
}
// statement not reached
//return ch;
|
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();
if (length > ch)
length = ch;
// If nothing is available, block to read only one character
if (length < 1)
length = 1;
if ((ch = read()) == -1)
return -1;
off = offset;
do
{
buffer[offset++] = (byte)ch;
}
while (--length > 0 && (ch = read()) != -1);
return (offset - off);
|