net.jini.jeri.connection
Class ConnectionManager.Outbound.Input

java.lang.Object
  extended by java.io.InputStream
      extended by net.jini.jeri.connection.ConnectionManager.Outbound.Input
All Implemented Interfaces:
Closeable
Enclosing class:
ConnectionManager.Outbound

private final class ConnectionManager.Outbound.Input
extends InputStream

Wrapper for the response input stream of an outbound request, used to call readResponseData on the underlying connection before subsequent data is read by higher levels. Note that this class does not support mark/reset.


Field Summary
private  OutboundRequestHandle handle
          The handle, or null if readResponseData has been called.
private  InputStream in
          The underlying input stream from the outbound request.
 
Constructor Summary
ConnectionManager.Outbound.Input(OutboundRequestHandle handle)
           
 
Method Summary
 int available()
          Call readFirst, then pass through.
 void close()
          pass-through
 int read()
          Call readFirst, then pass through.
 int read(byte[] b, int off, int len)
          Call readFirst, then pass through.
private  void readFirst()
          Calls readResponseData on the connection, exactly once.
 long skip(long n)
          Call readFirst, then pass through.
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

in

private final InputStream in
The underlying input stream from the outbound request.


handle

private OutboundRequestHandle handle
The handle, or null if readResponseData has been called.

Constructor Detail

ConnectionManager.Outbound.Input

ConnectionManager.Outbound.Input(OutboundRequestHandle handle)
Method Detail

readFirst

private void readFirst()
                throws IOException
Calls readResponseData on the connection, exactly once. Sets the handle to null to indicate that it has been called.

Throws:
IOException

read

public int read()
         throws IOException
Call readFirst, then pass through.

Specified by:
read in class InputStream
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Call readFirst, then pass through.

Overrides:
read in class InputStream
Throws:
IOException

skip

public long skip(long n)
          throws IOException
Call readFirst, then pass through.

Overrides:
skip in class InputStream
Throws:
IOException

available

public int available()
              throws IOException
Call readFirst, then pass through.

Overrides:
available in class InputStream
Throws:
IOException

close

public void close()
           throws IOException
pass-through

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


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.