gnu.inet.util
Class MessageInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by gnu.inet.util.MessageInputStream
All Implemented Interfaces:
java.io.Closeable

public class MessageInputStream
extends java.io.FilterInputStream

A utility class for feeding message contents to messages. This stream returns -1 from read when the stream termination sequence LF,END,LF is read from the underlying stream.

Author:
Chris Burdess

Field Summary
protected  int buf1
           
protected  int buf2
           
static int END
          The stream termination octet ('.').
protected  boolean eof
           
static int LF
          The line termination octet ('\n').
protected  int markBuf1
           
protected  int markBuf2
           
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
MessageInputStream(java.io.InputStream in)
          Constructs a message input stream connected to the specified input stream.
 
Method Summary
 void mark(int readlimit)
           
 boolean markSupported()
           
 int read()
          Reads the next byte of data from this message input stream.
 int read(byte[] b)
          Reads up to b.length bytes of data from this input stream into an array of bytes.
 int read(byte[] b, int off, int len)
          Reads up to len bytes of data from this input stream into an array of bytes, starting at the specified offset.
 void reset()
           
 
Methods inherited from class java.io.FilterInputStream
available, close, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

END

public static final int END
The stream termination octet ('.').

See Also:
Constant Field Values

LF

public static final int LF
The line termination octet ('\n').

See Also:
Constant Field Values

eof

protected boolean eof

buf1

protected int buf1

buf2

protected int buf2

markBuf1

protected int markBuf1

markBuf2

protected int markBuf2
Constructor Detail

MessageInputStream

public MessageInputStream(java.io.InputStream in)
Constructs a message input stream connected to the specified input stream.

Method Detail

read

public int read()
         throws java.io.IOException
Reads the next byte of data from this message input stream. Returns -1 if the end of the message stream has been reached.

Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException - if an I/O error occurs

read

public int read(byte[] b)
         throws java.io.IOException
Reads up to b.length bytes of data from this input stream into an array of bytes. Returns -1 if the end of the stream has been reached.

Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException - if an I/O error occurs

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Reads up to len bytes of data from this input stream into an array of bytes, starting at the specified offset. Returns -1 if the end of the stream has been reached.

Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException - if an I/O error occurs

markSupported

public boolean markSupported()
Overrides:
markSupported in class java.io.FilterInputStream

mark

public void mark(int readlimit)
Overrides:
mark in class java.io.FilterInputStream

reset

public void reset()
           throws java.io.IOException
Overrides:
reset in class java.io.FilterInputStream
Throws:
java.io.IOException


© Copyright 2003 The Free Software Foundation, all rights reserved