Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.james.mime4j.io
Class RootInputStream

    java.lang.Object
      java.io.InputStream
          java.io.FilterInputStream
              org.apache.james.mime4j.io.RootInputStream

All Implemented Interfaces:
  java.io.Closeable

    public class RootInputStream

extends java.io.FilterInputStream

`InputStream` used by the parser to wrap the original user supplied stream. This stream keeps track of the current line number and can also be truncated. When truncated the stream will appear to have reached end of file. This is used by the parser's `MimeStreamParser.stop()` method.

Field Summary

Fields inherited from class java.io.FilterInputStream
`in`

Constructor Summary
`RootInputStream(java.io.InputStream is)` Creates a new `RootInputStream`.

Method Summary
`int` | `getLineNumber()` Gets the current line number starting at 1 (the number of `\r\n` read so far plus 1).
`int` | `read()`
`int` | `read(byte[] b, int off, int len)`
`void` | `truncate()` Truncates this `InputStream`.

Methods inherited from class java.io.FilterInputStream
`available, close, mark, markSupported, read, reset, skip`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RootInputStream

    public RootInputStream(java.io.InputStream is)

  Creates a new `RootInputStream`.

  Parameters:
    `is` - the stream to read from.

Method Detail

### getLineNumber

    public int getLineNumber()

  Gets the current line number starting at 1 (the number of `\r\n` read so far plus 1).

  Returns:
    the current line number.

### truncate

    public void truncate()

  Truncates this `InputStream`. After this call any call to `read()`, `FilterInputStream.read(byte[])` or `read(byte[], int, int)` will return -1 as if end-of-file had been reached.

### read

    public int read()
             throws java.io.IOException

  Overrides:
    `read` in class `java.io.FilterInputStream`
  Throws:
    `java.io.IOException`
  See Also:
    `InputStream.read()`

### read

    public int read(byte[] b,
                    int off,
                    int len)
             throws java.io.IOException

  Overrides:
    `read` in class `java.io.FilterInputStream`
  Throws:
    `java.io.IOException`
  See Also:
    `InputStream.read(byte[], int, int)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.