org.fcrepo.client
Class HttpInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.fcrepo.client.HttpInputStream
All Implemented Interfaces:
Closeable

public class HttpInputStream
extends InputStream

An InputStream from an HttpMethod. When this InputStream is close()d, the underlying http connection is automatically released.


Constructor Summary
HttpInputStream(org.apache.commons.httpclient.HttpClient client, org.apache.commons.httpclient.HttpMethod method, String url)
           
 
Method Summary
 int available()
           
 void close()
          Release the underlying http connection and close the InputStream.
 void finalize()
          Automatically close on garbage collection.
 int getContentLength()
          Get CONTENT-LENGTH in bytes.
 String getContentType()
          Get CONTENT-TYPE
 String getMethodName()
          Get the http method name (GET or POST).
 org.apache.commons.httpclient.Header getResponseHeader(String name)
          Get a header value.
 int getStatusCode()
          Get the http status code.
 String getStatusText()
          Get the "reason phrase" associated with the status code.
 String getURL()
          Get the original URL of the http request this InputStream is based on.
 void mark(int readlimit)
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 void reset()
           
 long skip(long n)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpInputStream

public HttpInputStream(org.apache.commons.httpclient.HttpClient client,
                       org.apache.commons.httpclient.HttpMethod method,
                       String url)
                throws IOException
Throws:
IOException
Method Detail

getMethodName

public String getMethodName()
Get the http method name (GET or POST).


getURL

public String getURL()
Get the original URL of the http request this InputStream is based on.


getStatusCode

public int getStatusCode()
Get the http status code.


getStatusText

public String getStatusText()
Get the "reason phrase" associated with the status code.


getResponseHeader

public org.apache.commons.httpclient.Header getResponseHeader(String name)
Get a header value.


getContentType

public String getContentType()
Get CONTENT-TYPE


getContentLength

public int getContentLength()
Get CONTENT-LENGTH in bytes.


finalize

public void finalize()
Automatically close on garbage collection.

Overrides:
finalize in class Object

read

public int read()
         throws IOException
Specified by:
read in class InputStream
Throws:
IOException

read

public int read(byte[] b)
         throws IOException
Overrides:
read in class InputStream
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Overrides:
read in class InputStream
Throws:
IOException

skip

public long skip(long n)
          throws IOException
Overrides:
skip in class InputStream
Throws:
IOException

available

public int available()
              throws IOException
Overrides:
available in class InputStream
Throws:
IOException

mark

public void mark(int readlimit)
Overrides:
mark in class InputStream

reset

public void reset()
           throws IOException
Overrides:
reset in class InputStream
Throws:
IOException

markSupported

public boolean markSupported()
Overrides:
markSupported in class InputStream

close

public void close()
           throws IOException
Release the underlying http connection and close the InputStream.

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


Copyright © 2012 DuraSpace. All Rights Reserved.