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:
  `Closeable`, `AutoCloseable`

Direct Known Subclasses:
  `GassInputStream`

public class HTTPInputStream extends GlobusInputStream

## Field Summary

Fields
Modifier and Type
Field
Description
`protected InputStream`
`input`
`protected long`
`size`
`protected Socket`
`socket`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`HTTPInputStream()`
Private constructor used by subclasses.
``
`HTTPInputStream(String host, int port, String file)`
Opens HTTP input stream connection (unsecure)

## Method Summary

Modifier and Type
Method
Description
`void`
`abort()`
Aborts transfer.
`int`
`available()`
`void`
`close()`
`protected void`
`get(String host, int port, String file)`
`long`
`getSize()`
Returns the total size of input data.
`protected Socket`
`openSocket(String host, int port)`
`int`
`read()`
`int`
`read(byte[] msg)`
`int`
`read(byte[] buf, int off, int len)`

### Methods inherited from class java.io.InputStream

`mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### input

protected InputStream input

### socket

protected Socket socket

### size

protected long size

## Constructor Details

### HTTPInputStream

protected HTTPInputStream()
Private constructor used by subclasses.

### HTTPInputStream

public HTTPInputStream(String host, int port, String file) throws IOException
Opens 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:
  `IOException`

## Method Details

### openSocket

protected Socket openSocket(String host, int port) throws IOException

Throws:
  `IOException`

### get

protected void get(String host, int port, String file) throws IOException

Throws:
  `IOException`

### abort

public void abort()
Description copied from class: `GlobusInputStream`
Aborts transfer. Usually makes sure to release all resources (sockets, file descriptors)
Does nothing by default.

Overrides:
  `abort` in class `GlobusInputStream`

### getSize

public long getSize()
Description copied from class: `GlobusInputStream`
Returns the total size of input data.

Overrides:
  `getSize` in class `GlobusInputStream`
Returns:
  -1 if size is unknown.

### close

public void close() throws IOException

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

### read

public int read(byte[] msg) throws IOException

Overrides:
  `read` in class `InputStream`
Throws:
  `IOException`

### read

public int read(byte[] buf, int off, int len) throws IOException

Overrides:
  `read` in class `InputStream`
Throws:
  `IOException`

### read

public int read() throws IOException

Overrides:
  `read` in class `GlobusInputStream`
Throws:
  `IOException`

### available

public int available() throws IOException

Overrides:
  `available` in class `InputStream`
Throws:
  `IOException`