ucar.nc2.util.net
Class HTTPMethodStream

java.lang.Object
  extended by java.io.InputStream
      extended by ucar.nc2.util.net.HTTPMethodStream
All Implemented Interfaces:
Closeable

public class HTTPMethodStream
extends InputStream

THe goal of this class is to allow other classes to access the data stream associated with a method response. It tracks the method and the session to allow them to be closed when the stream hits eof.


Constructor Summary
HTTPMethodStream()
           
HTTPMethodStream(HTTPSession session, HTTPMethod method, InputStream methodstream)
           
 
Method Summary
 void close()
          Closes this input stream and releases any system resources associated with the stream.
 int read()
          Reads the next byte of data from the input stream.
 
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

HTTPMethodStream

public HTTPMethodStream()

HTTPMethodStream

public HTTPMethodStream(HTTPSession session,
                        HTTPMethod method,
                        InputStream methodstream)
Method Detail

read

public int read()
         throws IOException
Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

A subclass must provide an implementation of this method.

Specified by:
read in class InputStream
Returns:
the next byte of data, or -1 if the end of the stream is reached.
Throws:
IOException - if an I/O error occurs.

close

public void close()
           throws IOException
Closes this input stream and releases any system resources associated with the stream.

The close method of InputStream does nothing.

Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException - if an I/O error occurs.


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.