## org.cybergarage.http
Class HTTPPacket

    java.lang.Object
      org.cybergarage.http.HTTPPacket

Direct Known Subclasses:
  HTTPRequest, HTTPResponse

    public class HTTPPacket

extends Object

Constructor Summary
`HTTPPacket()`
`HTTPPacket(HTTPPacket httpPacket)`
`HTTPPacket(InputStream in)`

Method Summary
`void` `addHeader(HTTPHeader header)`
`void` `addHeader(String name, String value)`
`void` `clearHeaders()`
`String` `getCacheControl()`
`String` `getConnection()`
`byte[]` `getContent()`
`InputStream` `getContentInputStream()`
`long` `getContentLength()`
`long[]` `getContentRange()`
`long` `getContentRangeFirstPosition()`
`long` `getContentRangeInstanceLength()`
`long` `getContentRangeLastPosition()`
`String` `getContentString()`
`String` `getContentType()`
`String` `getDate()`
`protected String` `getFirstLine()`
`protected String` `getFirstLineToken(int num)`
`HTTPHeader` `getHeader(int n)`
`HTTPHeader` `getHeader(String name)`
`String` `getHeaderString()`
`String` `getHeaderValue(String name)`
`String` `getHost()`
`int` `getIntegerHeaderValue(String name)`
`long` `getLongHeaderValue(String name)`
`int` `getNHeaders()`
`String` `getServer()`
`String` `getStringHeaderValue(String name)`
`String` `getStringHeaderValue(String name, String startWidth, String endWidth)`
`String` `getTransferEncoding()`
`String` `getVersion()`
`boolean` `hasConnection()`
`boolean` `hasContent()`
`boolean` `hasContentInputStream()`
`boolean` `hasContentRange()`
`boolean` `hasFirstLine()`
`boolean` `hasHeader(String name)`
`boolean` `hasTransferEncoding()`
`void` `init()`
`boolean` `isChunked()`
`boolean` `isCloseConnection()`
`boolean` `isKeepAliveConnection()`
`boolean` `read(HTTPSocket httpSock)`
`protected void` `set(HTTPPacket httpPacket)`
`protected boolean` `set(HTTPSocket httpSock)`
`protected boolean` `set(InputStream in)`
`protected boolean` `set(InputStream in, boolean onlyHeaders)`
`void` `setCacheControl(int value)`
`void` `setCacheControl(String directive)`
`void` `setCacheControl(String directive, int value)`
`void` `setConnection(String value)`
`void` `setContent(byte[] data)`
`void` `setContent(byte[] data, boolean updateWithContentLength)`
`void` `setContent(String data)`
`void` `setContent(String data, boolean updateWithContentLength)`
`void` `setContentInputStream(InputStream in)`
`void` `setContentLength(long len)`
`void` `setContentRange(long firstPos, long lastPos, long length)`
`void` `setContentType(String type)`
`void` `setDate(Calendar cal)`
`void` `setHeader(HTTPHeader header)`
`void` `setHeader(String name, int value)`
`void` `setHeader(String name, long value)`
`void` `setHeader(String name, String value)`
`void` `setHost(String host, int port)`
`void` `setIntegerHeader(String name, int value)`
`void` `setLongHeader(String name, long value)`
`void` `setServer(String name)`
`void` `setStringHeader(String name, String value)`
`void` `setStringHeader(String name, String value, String startWidth, String endWidth)`
`void` `setTransferEncoding(String value)`
`void` `setVersion(String ver)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### HTTPPacket

    public HTTPPacket()

### HTTPPacket

    public HTTPPacket(HTTPPacket httpPacket)

### HTTPPacket

    public HTTPPacket(InputStream in)

Method Detail

### init

    public void init()

### setVersion

    public void setVersion(String ver)

### getVersion

    public String getVersion()

### set

    protected boolean set(InputStream in,
                          boolean onlyHeaders)

### set

    protected boolean set(InputStream in)

### set

    protected boolean set(HTTPSocket httpSock)

### set

    protected void set(HTTPPacket httpPacket)

### read

    public boolean read(HTTPSocket httpSock)

### getFirstLine

    protected String getFirstLine()

### getFirstLineToken

    protected String getFirstLineToken(int num)

### hasFirstLine

    public boolean hasFirstLine()

### getNHeaders

    public int getNHeaders()

### addHeader

    public void addHeader(HTTPHeader header)

### addHeader

    public void addHeader(String name,
                          String value)

### getHeader

    public HTTPHeader getHeader(int n)

### getHeader

    public HTTPHeader getHeader(String name)

### clearHeaders

    public void clearHeaders()

### hasHeader

    public boolean hasHeader(String name)

### setHeader

    public void setHeader(String name,
                          String value)

### setHeader

    public void setHeader(String name,
                          int value)

### setHeader

    public void setHeader(String name,
                          long value)

### setHeader

    public void setHeader(HTTPHeader header)

### getHeaderValue

    public String getHeaderValue(String name)

### setStringHeader

    public void setStringHeader(String name,
                                String value,
                                String startWidth,
                                String endWidth)

### setStringHeader

    public void setStringHeader(String name,
                                String value)

### getStringHeaderValue

    public String getStringHeaderValue(String name,
                                       String startWidth,
                                       String endWidth)

### getStringHeaderValue

    public String getStringHeaderValue(String name)

### setIntegerHeader

    public void setIntegerHeader(String name,
                                 int value)

### setLongHeader

    public void setLongHeader(String name,
                              long value)

### getIntegerHeaderValue

    public int getIntegerHeaderValue(String name)

### getLongHeaderValue

    public long getLongHeaderValue(String name)

### getHeaderString

    public String getHeaderString()

### setContent

    public void setContent(byte[] data,
                           boolean updateWithContentLength)

### setContent

    public void setContent(byte[] data)

### setContent

    public void setContent(String data,
                           boolean updateWithContentLength)

### setContent

    public void setContent(String data)

### getContent

    public byte[] getContent()

### getContentString

    public String getContentString()

### hasContent

    public boolean hasContent()

### setContentInputStream

    public void setContentInputStream(InputStream in)

### getContentInputStream

    public InputStream getContentInputStream()

### hasContentInputStream

    public boolean hasContentInputStream()

### setContentType

    public void setContentType(String type)

### getContentType

    public String getContentType()

### setContentLength

    public void setContentLength(long len)

### getContentLength

    public long getContentLength()

### hasConnection

    public boolean hasConnection()

### setConnection

    public void setConnection(String value)

### getConnection

    public String getConnection()

### isCloseConnection

    public boolean isCloseConnection()

### isKeepAliveConnection

    public boolean isKeepAliveConnection()

### hasContentRange

    public boolean hasContentRange()

### setContentRange

    public void setContentRange(long firstPos,
                                long lastPos,
                                long length)

### getContentRange

    public long[] getContentRange()

### getContentRangeFirstPosition

    public long getContentRangeFirstPosition()

### getContentRangeLastPosition

    public long getContentRangeLastPosition()

### getContentRangeInstanceLength

    public long getContentRangeInstanceLength()

### setCacheControl

    public void setCacheControl(String directive)

### setCacheControl

    public void setCacheControl(String directive,
                                int value)

### setCacheControl

    public void setCacheControl(int value)

### getCacheControl

    public String getCacheControl()

### setServer

    public void setServer(String name)

### getServer

    public String getServer()

### setHost

    public void setHost(String host,
                        int port)

### getHost

    public String getHost()

### setDate

    public void setDate(Calendar cal)

### getDate

    public String getDate()

### hasTransferEncoding

    public boolean hasTransferEncoding()

### setTransferEncoding

    public void setTransferEncoding(String value)

### getTransferEncoding

    public String getTransferEncoding()

### isChunked

    public boolean isChunked()