org.restlet.engine.http.io
Class InputEntityStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.restlet.engine.http.io.InputEntityStream
All Implemented Interfaces:
Closeable
Direct Known Subclasses:
ChunkedInputStream, ClosingInputStream, SizedInputStream

public abstract class InputEntityStream
extends InputStream

Input stream that synchronizes the state of a Connection instance and an input stream.


Constructor Summary
InputEntityStream(Notifiable notifiable, InputStream inboundStream)
          Constructor.
 
Method Summary
protected  InputStream getInboundStream()
          Returns the inbound stream.
protected  void onEndReached()
          To be called when the end of the stream is reached.
protected  void onError()
          To be called when there is an error when handling the stream.
 
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputEntityStream

public InputEntityStream(Notifiable notifiable,
                         InputStream inboundStream)
Constructor.

Parameters:
notifiable - The notifiable connection.
inboundStream - The inbound stream.
Method Detail

getInboundStream

protected InputStream getInboundStream()
Returns the inbound stream.

Returns:
The inbound stream.

onEndReached

protected void onEndReached()
To be called when the end of the stream is reached. By default, it updates the state of the connection ( Connection.setInboundBusy(boolean)) .


onError

protected void onError()
To be called when there is an error when handling the stream. By default it calls onEndReached() and set the state of the connection to ConnectionState.CLOSING in order to release this stream.



Copyright © 2005-2011 Noelios Technologies.