Quadcap Embeddable Server

com.quadcap.io.DotStuffInputStream Class Reference

Inheritance diagram for com.quadcap.io.DotStuffInputStream:

InputStream List of all members.

Detailed Description

A filter input stream that performs dot-unstuffing.

Author:
Stan Bailes

Definition at line 52 of file DotStuffInputStream.java.

Public Member Functions

 DotStuffInputStream (InputStream in) throws IOException
int read () throws IOException
 Reads the next byte of data from this input stream.

int read (byte b[], int off, int len) throws IOException
 Reads up to len bytes of data from this input stream into an array of bytes.

long skip (long n) throws IOException
 Skips over and discards n bytes of data from the input stream.


Package Attributes

InputStream in
int state = INIT
int savec = -1

Static Package Attributes

final byte CR = (byte)'\r'
final byte LF = (byte)'\n'
final byte DT = (byte)'.'
final int INIT = 0
final int END = 1
final int S1 = 2
final int S2 = 3
final int S3 = 4
final int S4 = 5


Constructor & Destructor Documentation

com.quadcap.io.DotStuffInputStream.DotStuffInputStream InputStream  in  )  throws IOException
 

Definition at line 69 of file DotStuffInputStream.java.

References com.quadcap.io.DotStuffInputStream.in.


Member Function Documentation

int com.quadcap.io.DotStuffInputStream.read byte  b[],
int  off,
int  len
throws IOException
 

Reads up to len bytes of data from this input stream into an array of bytes.

This method blocks until some input is available.

Parameters:
b the buffer into which the data is read.
off the start offset of the data.
len the maximum number of bytes read.
Returns:
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
Exceptions:
IOException if an I/O error occurs.

Definition at line 149 of file DotStuffInputStream.java.

int com.quadcap.io.DotStuffInputStream.read  )  throws IOException
 

Reads the next byte of data from this input stream.

The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

The read method of DotStuffInputStream returns -1 when the characteristic 'single dot on a line by itself' end signature, and removes all leading dots otherwise.

Returns:
the next byte of data, or -1 if the end of the stream is reached.
Exceptions:
IOException if an I/O error occurs.

Definition at line 90 of file DotStuffInputStream.java.

References com.quadcap.io.DotStuffInputStream.CR, com.quadcap.io.DotStuffInputStream.DT, com.quadcap.io.DotStuffInputStream.END, com.quadcap.io.DotStuffInputStream.in, com.quadcap.io.DotStuffInputStream.INIT, com.quadcap.io.DotStuffInputStream.LF, com.quadcap.io.DotStuffInputStream.S1, com.quadcap.io.DotStuffInputStream.S2, com.quadcap.io.DotStuffInputStream.S3, com.quadcap.io.DotStuffInputStream.S4, com.quadcap.io.DotStuffInputStream.savec, and com.quadcap.io.DotStuffInputStream.state.

Referenced by com.quadcap.io.Test.testDot().

long com.quadcap.io.DotStuffInputStream.skip long  n  )  throws IOException
 

Skips over and discards n bytes of data from the input stream.

The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. The actual number of bytes skipped is returned.

Parameters:
n the number of bytes to be skipped.
Returns:
the actual number of bytes skipped.
Exceptions:
IOException if an I/O error occurs.

Definition at line 169 of file DotStuffInputStream.java.

References com.quadcap.io.DotStuffInputStream.skip().

Referenced by com.quadcap.io.DotStuffInputStream.skip().


Member Data Documentation

final byte com.quadcap.io.DotStuffInputStream.CR = (byte)'\r' [static, package]
 

Definition at line 55 of file DotStuffInputStream.java.

Referenced by com.quadcap.io.DotStuffInputStream.read().

final byte com.quadcap.io.DotStuffInputStream.DT = (byte)'.' [static, package]
 

Definition at line 57 of file DotStuffInputStream.java.

Referenced by com.quadcap.io.DotStuffInputStream.read().

final int com.quadcap.io.DotStuffInputStream.END = 1 [static, package]
 

Definition at line 60 of file DotStuffInputStream.java.

Referenced by com.quadcap.io.DotStuffInputStream.read().

InputStream com.quadcap.io.DotStuffInputStream.in [package]
 

Definition at line 53 of file DotStuffInputStream.java.

Referenced by com.quadcap.io.DotStuffInputStream.DotStuffInputStream(), and com.quadcap.io.DotStuffInputStream.read().

final int com.quadcap.io.DotStuffInputStream.INIT = 0 [static, package]
 

Definition at line 59 of file DotStuffInputStream.java.

Referenced by com.quadcap.io.DotStuffInputStream.read().

final byte com.quadcap.io.DotStuffInputStream.LF = (byte)'\n' [static, package]
 

Definition at line 56 of file DotStuffInputStream.java.

Referenced by com.quadcap.io.DotStuffInputStream.read().

final int com.quadcap.io.DotStuffInputStream.S1 = 2 [static, package]
 

Definition at line 61 of file DotStuffInputStream.java.

Referenced by com.quadcap.io.DotStuffInputStream.read().

final int com.quadcap.io.DotStuffInputStream.S2 = 3 [static, package]
 

Definition at line 62 of file DotStuffInputStream.java.

Referenced by com.quadcap.io.DotStuffInputStream.read().

final int com.quadcap.io.DotStuffInputStream.S3 = 4 [static, package]
 

Definition at line 63 of file DotStuffInputStream.java.

Referenced by com.quadcap.io.DotStuffInputStream.read().

final int com.quadcap.io.DotStuffInputStream.S4 = 5 [static, package]
 

Definition at line 64 of file DotStuffInputStream.java.

Referenced by com.quadcap.io.DotStuffInputStream.read().

int com.quadcap.io.DotStuffInputStream.savec = -1 [package]
 

Definition at line 67 of file DotStuffInputStream.java.

Referenced by com.quadcap.io.DotStuffInputStream.read().

int com.quadcap.io.DotStuffInputStream.state = INIT [package]
 

Definition at line 66 of file DotStuffInputStream.java.

Referenced by com.quadcap.io.DotStuffInputStream.read().