Package org.globus.io.streams
Class HTTPInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.globus.io.streams.GlobusInputStream
-
- org.globus.io.streams.HTTPInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Direct Known Subclasses:
GassInputStream
public class HTTPInputStream extends GlobusInputStream
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedHTTPInputStream()Private constructor used by subclasses.HTTPInputStream(java.lang.String host, int port, java.lang.String file)Opens HTTP input stream connection (unsecure)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort()Aborts transfer.intavailable()voidclose()protected voidget(java.lang.String host, int port, java.lang.String file)longgetSize()Returns the total size of input data.protected java.net.SocketopenSocket(java.lang.String host, int port)intread()intread(byte[] msg)intread(byte[] buf, int off, int len)
-
-
-
Constructor Detail
-
HTTPInputStream
protected HTTPInputStream()
Private constructor used by subclasses.
-
HTTPInputStream
public HTTPInputStream(java.lang.String host, int port, java.lang.String file) throws java.io.IOExceptionOpens HTTP input stream connection (unsecure)- Parameters:
host- host name of the HTTP server.port- port number of the HTTP server.file- file to retrieve from the server.- Throws:
java.io.IOException
-
-
Method Detail
-
openSocket
protected java.net.Socket openSocket(java.lang.String host, int port) throws java.io.IOException- Throws:
java.io.IOException
-
get
protected void get(java.lang.String host, int port, java.lang.String file) throws java.io.IOException- Throws:
java.io.IOException
-
abort
public void abort()
Description copied from class:GlobusInputStreamAborts transfer. Usually makes sure to release all resources (sockets, file descriptors)
Does nothing by default.- Overrides:
abortin classGlobusInputStream
-
getSize
public long getSize()
Description copied from class:GlobusInputStreamReturns the total size of input data.- Overrides:
getSizein classGlobusInputStream- Returns:
- -1 if size is unknown.
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] msg) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] buf, int off, int len) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException- Overrides:
readin classGlobusInputStream- Throws:
java.io.IOException
-
available
public int available() throws java.io.IOException- Overrides:
availablein classjava.io.InputStream- Throws:
java.io.IOException
-
-