org.freehep.util.io
Class RoutedInputStream.Route

java.lang.Object
  extended by java.io.InputStream
      extended by org.freehep.util.io.RoutedInputStream.Route
All Implemented Interfaces:
Closeable
Enclosing class:
RoutedInputStream

public class RoutedInputStream.Route
extends InputStream

Route which can be read up to and including the end marker. When you close the route, all bytes including the end marker will be read/discarded before returning. If you just discard the Route, the underlying stream will still return you all or part of the bytes of this route. If the end marker is set to null, the stream can be read until the underlying stream ends.


Constructor Summary
RoutedInputStream.Route(byte[] start, byte[] end)
          Creates a route with given start and end marker.
 
Method Summary
 void close()
          Closes the stream, and discards any bytes up to and including the end marker.
 byte[] getEnd()
          Returns end marker.
 byte[] getStart()
          Returns start marker.
 int read()
          Returns bytes of this specific route, starting with the start marker, followed by any bytes up to and including the end marker.
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RoutedInputStream.Route

public RoutedInputStream.Route(byte[] start,
                               byte[] end)
Creates a route with given start and end marker.

Parameters:
start - start marker
end - end marker
Method Detail

read

public int read()
         throws IOException
Returns bytes of this specific route, starting with the start marker, followed by any bytes up to and including the end marker. If the end marker is null, the route is indefinite.

Specified by:
read in class InputStream
Throws:
IOException

close

public void close()
           throws IOException
Closes the stream, and discards any bytes up to and including the end marker.

Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException

getStart

public byte[] getStart()
Returns start marker.

Returns:
start marker

getEnd

public byte[] getEnd()
Returns end marker.

Returns:
end marker


Copyright © 2000-2007 FreeHEP. All Rights Reserved.