### php.java.bridge.http

# Class HttpRequest

- `java.lang.Object`

- `php.java.bridge.http.HttpRequest`

`public class HttpRequest`
`extends java.lang.Object`

A simple HTTP request implementation.

Author:
  jostb

## Constructor Summary

`HttpRequest(java.io.InputStream inputStream)`
  Create a new HTTP request

## Method Summary

`void`

`addHeader(java.lang.String line)`
  Add a header

`java.lang.String`

`getHeader(java.lang.String string)`
  Returns the header value

`java.io.InputStream`

`getInputStream()`
  Returns the InputStream

`void`

`pushBack(byte[] buf, int start, int length)`
  Push back some bytes so that we can read them again.

`void`

`setContentLength(int contentLength)`
  Set the content length, it causes the InputStream to stop reading at some point.

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

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

## Constructor Details

### HttpRequest

    public HttpRequest(java.io.InputStream inputStream)

> Create a new HTTP request

> Parameters:
>   `inputStream` - The InputStream

## Method Details

### addHeader

    public void addHeader(java.lang.String line)

> Add a header

> Parameters:
>   `line` - A valid HTTP header, e.g. "Host: localhost"

### getHeader

    public java.lang.String getHeader(java.lang.String string)

> Returns the header value

> Parameters:
>   `string` - The header

> Returns:
>   The header value

### getInputStream

    public java.io.InputStream getInputStream()

> Returns the InputStream

> Returns:
>   The InputStream

### pushBack

    public void pushBack(byte[] buf,
                         int start,
                         int length)

> Push back some bytes so that we can read them again.

> Parameters:
>   `buf` - The buffer
>   `start` - The start position
>   `length` - The number of bytes

### setContentLength

    public void setContentLength(int contentLength)

> Set the content length, it causes the InputStream to stop reading at some point.

> Parameters:
>   `contentLength` - The content length.

> See Also:
>   `getInputStream()`