## com.easysw.cups
Class IPPHttp

    java.lang.Object
      |
      +--com.easysw.cups.IPPHttp

public class IPPHttp
extends java.lang.Object

Field Summary
`int` `activity`
`java.lang.String` `auth_type`
`java.io.BufferedReader` `br`
`java.net.Socket` `conn`
`boolean` `connected`
`static java.lang.String[]` `days`
`int` `error`
`java.lang.String` `hostname`
`static int` `HTTP_0_9`
`static int` `HTTP_1_0`
`static int` `HTTP_1_1`
`static int` `HTTP_ACCEPTED`
`static int` `HTTP_AUTH_BASIC`
`static int` `HTTP_AUTH_MD5`
`static int` `HTTP_AUTH_MD5_INT`
`static int` `HTTP_AUTH_MD5_SESS`
`static int` `HTTP_AUTH_MD5_SESS_INT`
`static int` `HTTP_AUTH_NONE`
`static int` `HTTP_BAD_GATEWAY`
`static int` `HTTP_BAD_REQUEST`
`static int` `HTTP_CLOSE`
`static int` `HTTP_CONFLICT`
`int` `http_content_length`
`static int` `HTTP_CONTINUE`
`static int` `HTTP_CREATED`
`static int` `HTTP_DELETE`
`static int` `HTTP_ENCODE_CHUNKED`
`static int` `HTTP_ENCODE_LENGTH`
`static int` `HTTP_ENCRYPT_ALWAYS`
`static int` `HTTP_ENCRYPT_IF_REQUESTED`
`static int` `HTTP_ENCRYPT_NEVER`
`static int` `HTTP_ENCRYPT_REQUIRED`
`static int` `HTTP_ERROR`
`static int` `HTTP_FIELD_ACCEPT_LANGUAGE`
`static int` `HTTP_FIELD_ACCEPT_RANGES`
`static int` `HTTP_FIELD_AUTHORIZATION`
`static int` `HTTP_FIELD_CONNECTION`
`static int` `HTTP_FIELD_CONTENT_ENCODING`
`static int` `HTTP_FIELD_CONTENT_LANGUAGE`
`static int` `HTTP_FIELD_CONTENT_LENGTH`
`static int` `HTTP_FIELD_CONTENT_LOCATION`
`static int` `HTTP_FIELD_CONTENT_MD5`
`static int` `HTTP_FIELD_CONTENT_RANGE`
`static int` `HTTP_FIELD_CONTENT_TYPE`
`static int` `HTTP_FIELD_CONTENT_VERSION`
`static int` `HTTP_FIELD_DATE`
`static int` `HTTP_FIELD_HOST`
`static int` `HTTP_FIELD_IF_MODIFIED_SINCE`
`static int` `HTTP_FIELD_IF_UNMODIFIED_SINCE`
`static int` `HTTP_FIELD_KEEP_ALIVE`
`static int` `HTTP_FIELD_LAST_MODIFIED`
`static int` `HTTP_FIELD_LINK`
`static int` `HTTP_FIELD_LOCATION`
`static int` `HTTP_FIELD_MAX`
`static int` `HTTP_FIELD_RANGE`
`static int` `HTTP_FIELD_REFERER`
`static int` `HTTP_FIELD_RETRY_AFTER`
`static int` `HTTP_FIELD_TRANSFER_ENCODING`
`static int` `HTTP_FIELD_UNKNOWN`
`static int` `HTTP_FIELD_UPGRADE`
`static int` `HTTP_FIELD_USER_AGENT`
`static int` `HTTP_FIELD_WWW_AUTHENTICATE`
`static java.lang.String[]` `http_fields`
`static int` `HTTP_FORBIDDEN`
`static int` `HTTP_GATEWAY_TIMEOUT`
`static int` `HTTP_GET`
`static int` `HTTP_GET_SEND`
`static int` `HTTP_GONE`
`static int` `HTTP_HEAD`
`static int` `HTTP_KEEPALIVE_OFF`
`static int` `HTTP_KEEPALIVE_ON`
`static int` `HTTP_LENGTH_REQUIRED`
`static int` `HTTP_METHOD_NOT_ALLOWED`
`static int` `HTTP_MOVED_PERMANENTLY`
`static int` `HTTP_MOVED_TEMPORARILY`
`static int` `HTTP_MULTIPLE_CHOICES`
`static int` `HTTP_NO_CONTENT`
`static int` `HTTP_NOT_ACCEPTABLE`
`static int` `HTTP_NOT_AUTHORITATIVE`
`static int` `HTTP_NOT_FOUND`
`static int` `HTTP_NOT_IMPLEMENTED`
`static int` `HTTP_NOT_MODIFIED`
`static int` `HTTP_NOT_SUPPORTED`
`static int` `HTTP_OK`
`static int` `HTTP_OPTIONS`
`static int` `HTTP_PARTIAL_CONTENT`
`static int` `HTTP_PAYMENT_REQUIRED`
`static int` `HTTP_POST`
`static int` `HTTP_POST_RECV`
`static int` `HTTP_POST_SEND`
`static int` `HTTP_PRECONDITION`
`static int` `HTTP_PROXY_AUTHENTICATION`
`static int` `HTTP_PUT`
`static int` `HTTP_PUT_RECV`
`java.lang.String` `http_request`
`static int` `HTTP_REQUEST_TIMEOUT`
`static int` `HTTP_REQUEST_TOO_LARGE`
`static int` `HTTP_RESET_CONTENT`
`static int` `HTTP_SEE_OTHER`
`static int` `HTTP_SERVER_ERROR`
`static int` `HTTP_SERVICE_UNAVAILABLE`
`static int` `HTTP_STATUS`
`static int` `HTTP_SWITCHING_PROTOCOLS`
`static int` `HTTP_TRACE`
`static int` `HTTP_UNAUTHORIZED`
`static int` `HTTP_UNSUPPORTED_MEDIATYPE`
`static int` `HTTP_UPGRADE_REQUIRED`
`static int` `HTTP_URI_TOO_LONG`
`static int` `HTTP_USE_PROXY`
`static int` `HTTP_WAITING` Class constants - most not in use yet.
`java.io.BufferedInputStream` `is`
`java.lang.String` `method`
`static java.lang.String[]` `months`
`java.lang.String` `nonce`
`java.lang.String` `opaque`
`java.io.BufferedOutputStream` `os`
`java.lang.String` `passwd`
`java.lang.String` `path`
`int` `port`
`char[]` `read_buffer`
`java.lang.String` `read_header_charset`
`java.lang.String` `read_header_content_language`
`int` `read_header_content_length`
`java.lang.String` `read_header_content_type`
`java.lang.String` `read_header_date`
`java.lang.String` `read_header_server`
`java.lang.String` `realm`
`java.lang.String` `resource`
`int` `status`
`java.lang.String` `status_text`
`java.lang.String` `user`
`java.lang.String` `version`
`int` `write_content_length`

Constructor Summary
`IPPHttp(java.lang.String request_url)` Constructor using `URL`.
`IPPHttp(java.lang.String request_url, java.lang.String p_auth_type, java.lang.String p_user, java.lang.String p_passwd)` Constructor using `URL, user and pass`.

Method Summary
`int` `checkForResponse()`
`void` `parseAuthenticate(java.lang.String p_auth)`
`IPP` `processResponse()` Process the HTTP response from the server.
`int` `read_header()` Read the HTTP header from the input stream.
`java.lang.String` `read_line()` Read a line from the input stream.
`char[]` `read(int count)` Read up to `count` bytes from the input stream.
`boolean` `reConnect()` Re-establish a dropped connection.
`void` `setPassword(java.lang.String p_passwd)` Set the password.
`void` `setUser(java.lang.String p_user)` Set the user name.
`void` `write(byte[] bytes)` Write bytes to the output stream.
`void` `write(byte[] bytes, int length)` Write bytes to the output stream.
`int` `writeHeader(java.lang.String request, int content_length)` Write the request header bytes to the server.

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

Field Detail

### HTTP_WAITING

    public static final int HTTP_WAITING

  Class constants - most not in use yet.

### HTTP_OPTIONS

    public static final int HTTP_OPTIONS

### HTTP_GET

    public static final int HTTP_GET

### HTTP_GET_SEND

    public static final int HTTP_GET_SEND

### HTTP_HEAD

    public static final int HTTP_HEAD

### HTTP_POST

    public static final int HTTP_POST

### HTTP_POST_RECV

    public static final int HTTP_POST_RECV

### HTTP_POST_SEND

    public static final int HTTP_POST_SEND

### HTTP_PUT

    public static final int HTTP_PUT

### HTTP_PUT_RECV

    public static final int HTTP_PUT_RECV

### HTTP_DELETE

    public static final int HTTP_DELETE

### HTTP_TRACE

    public static final int HTTP_TRACE

### HTTP_CLOSE

    public static final int HTTP_CLOSE

### HTTP_STATUS

    public static final int HTTP_STATUS

### HTTP_0_9

    public static final int HTTP_0_9

### HTTP_1_0

    public static final int HTTP_1_0

### HTTP_1_1

    public static final int HTTP_1_1

### HTTP_KEEPALIVE_OFF

    public static final int HTTP_KEEPALIVE_OFF

### HTTP_KEEPALIVE_ON

    public static final int HTTP_KEEPALIVE_ON

### HTTP_ENCODE_LENGTH

    public static final int HTTP_ENCODE_LENGTH

### HTTP_ENCODE_CHUNKED

    public static final int HTTP_ENCODE_CHUNKED

### HTTP_ENCRYPT_IF_REQUESTED

    public static final int HTTP_ENCRYPT_IF_REQUESTED

### HTTP_ENCRYPT_NEVER

    public static final int HTTP_ENCRYPT_NEVER

### HTTP_ENCRYPT_REQUIRED

    public static final int HTTP_ENCRYPT_REQUIRED

### HTTP_ENCRYPT_ALWAYS

    public static final int HTTP_ENCRYPT_ALWAYS

### HTTP_AUTH_NONE

    public static final int HTTP_AUTH_NONE

### HTTP_AUTH_BASIC

    public static final int HTTP_AUTH_BASIC

### HTTP_AUTH_MD5

    public static final int HTTP_AUTH_MD5

### HTTP_AUTH_MD5_SESS

    public static final int HTTP_AUTH_MD5_SESS

### HTTP_AUTH_MD5_INT

    public static final int HTTP_AUTH_MD5_INT

### HTTP_AUTH_MD5_SESS_INT

    public static final int HTTP_AUTH_MD5_SESS_INT

### HTTP_ERROR

    public static final int HTTP_ERROR

### HTTP_CONTINUE

    public static final int HTTP_CONTINUE

### HTTP_SWITCHING_PROTOCOLS

    public static final int HTTP_SWITCHING_PROTOCOLS

### HTTP_OK

    public static final int HTTP_OK

### HTTP_CREATED

    public static final int HTTP_CREATED

### HTTP_ACCEPTED

    public static final int HTTP_ACCEPTED

### HTTP_NOT_AUTHORITATIVE

    public static final int HTTP_NOT_AUTHORITATIVE

### HTTP_NO_CONTENT

    public static final int HTTP_NO_CONTENT

### HTTP_RESET_CONTENT

    public static final int HTTP_RESET_CONTENT

### HTTP_PARTIAL_CONTENT

    public static final int HTTP_PARTIAL_CONTENT

### HTTP_MULTIPLE_CHOICES

    public static final int HTTP_MULTIPLE_CHOICES

### HTTP_MOVED_PERMANENTLY

    public static final int HTTP_MOVED_PERMANENTLY

### HTTP_MOVED_TEMPORARILY

    public static final int HTTP_MOVED_TEMPORARILY

### HTTP_SEE_OTHER

    public static final int HTTP_SEE_OTHER

### HTTP_NOT_MODIFIED

    public static final int HTTP_NOT_MODIFIED

### HTTP_USE_PROXY

    public static final int HTTP_USE_PROXY

### HTTP_BAD_REQUEST

    public static final int HTTP_BAD_REQUEST

### HTTP_UNAUTHORIZED

    public static final int HTTP_UNAUTHORIZED

### HTTP_PAYMENT_REQUIRED

    public static final int HTTP_PAYMENT_REQUIRED

### HTTP_FORBIDDEN

    public static final int HTTP_FORBIDDEN

### HTTP_NOT_FOUND

    public static final int HTTP_NOT_FOUND

### HTTP_METHOD_NOT_ALLOWED

    public static final int HTTP_METHOD_NOT_ALLOWED

### HTTP_NOT_ACCEPTABLE

    public static final int HTTP_NOT_ACCEPTABLE

### HTTP_PROXY_AUTHENTICATION

    public static final int HTTP_PROXY_AUTHENTICATION

### HTTP_REQUEST_TIMEOUT

    public static final int HTTP_REQUEST_TIMEOUT

### HTTP_CONFLICT

    public static final int HTTP_CONFLICT

### HTTP_GONE

    public static final int HTTP_GONE

### HTTP_LENGTH_REQUIRED

    public static final int HTTP_LENGTH_REQUIRED

### HTTP_PRECONDITION

    public static final int HTTP_PRECONDITION

### HTTP_REQUEST_TOO_LARGE

    public static final int HTTP_REQUEST_TOO_LARGE

### HTTP_URI_TOO_LONG

    public static final int HTTP_URI_TOO_LONG

### HTTP_UNSUPPORTED_MEDIATYPE

    public static final int HTTP_UNSUPPORTED_MEDIATYPE

### HTTP_UPGRADE_REQUIRED

    public static final int HTTP_UPGRADE_REQUIRED

### HTTP_SERVER_ERROR

    public static final int HTTP_SERVER_ERROR

### HTTP_NOT_IMPLEMENTED

    public static final int HTTP_NOT_IMPLEMENTED

### HTTP_BAD_GATEWAY

    public static final int HTTP_BAD_GATEWAY

### HTTP_SERVICE_UNAVAILABLE

    public static final int HTTP_SERVICE_UNAVAILABLE

### HTTP_GATEWAY_TIMEOUT

    public static final int HTTP_GATEWAY_TIMEOUT

### HTTP_NOT_SUPPORTED

    public static final int HTTP_NOT_SUPPORTED

### HTTP_FIELD_UNKNOWN

    public static final int HTTP_FIELD_UNKNOWN

### HTTP_FIELD_ACCEPT_LANGUAGE

    public static final int HTTP_FIELD_ACCEPT_LANGUAGE

### HTTP_FIELD_ACCEPT_RANGES

    public static final int HTTP_FIELD_ACCEPT_RANGES

### HTTP_FIELD_AUTHORIZATION

    public static final int HTTP_FIELD_AUTHORIZATION

### HTTP_FIELD_CONNECTION

    public static final int HTTP_FIELD_CONNECTION

### HTTP_FIELD_CONTENT_ENCODING

    public static final int HTTP_FIELD_CONTENT_ENCODING

### HTTP_FIELD_CONTENT_LANGUAGE

    public static final int HTTP_FIELD_CONTENT_LANGUAGE

### HTTP_FIELD_CONTENT_LENGTH

    public static final int HTTP_FIELD_CONTENT_LENGTH

### HTTP_FIELD_CONTENT_LOCATION

    public static final int HTTP_FIELD_CONTENT_LOCATION

### HTTP_FIELD_CONTENT_MD5

    public static final int HTTP_FIELD_CONTENT_MD5

### HTTP_FIELD_CONTENT_RANGE

    public static final int HTTP_FIELD_CONTENT_RANGE

### HTTP_FIELD_CONTENT_TYPE

    public static final int HTTP_FIELD_CONTENT_TYPE

### HTTP_FIELD_CONTENT_VERSION

    public static final int HTTP_FIELD_CONTENT_VERSION

### HTTP_FIELD_DATE

    public static final int HTTP_FIELD_DATE

### HTTP_FIELD_HOST

    public static final int HTTP_FIELD_HOST

### HTTP_FIELD_IF_MODIFIED_SINCE

    public static final int HTTP_FIELD_IF_MODIFIED_SINCE

### HTTP_FIELD_IF_UNMODIFIED_SINCE

    public static final int HTTP_FIELD_IF_UNMODIFIED_SINCE

### HTTP_FIELD_KEEP_ALIVE

    public static final int HTTP_FIELD_KEEP_ALIVE

### HTTP_FIELD_LAST_MODIFIED

    public static final int HTTP_FIELD_LAST_MODIFIED

### HTTP_FIELD_LINK

    public static final int HTTP_FIELD_LINK

### HTTP_FIELD_LOCATION

    public static final int HTTP_FIELD_LOCATION

### HTTP_FIELD_RANGE

    public static final int HTTP_FIELD_RANGE

### HTTP_FIELD_REFERER

    public static final int HTTP_FIELD_REFERER

### HTTP_FIELD_RETRY_AFTER

    public static final int HTTP_FIELD_RETRY_AFTER

### HTTP_FIELD_TRANSFER_ENCODING

    public static final int HTTP_FIELD_TRANSFER_ENCODING

### HTTP_FIELD_UPGRADE

    public static final int HTTP_FIELD_UPGRADE

### HTTP_FIELD_USER_AGENT

    public static final int HTTP_FIELD_USER_AGENT

### HTTP_FIELD_WWW_AUTHENTICATE

    public static final int HTTP_FIELD_WWW_AUTHENTICATE

### HTTP_FIELD_MAX

    public static final int HTTP_FIELD_MAX

### http_fields

    public static final java.lang.String[] http_fields

### days

    public static final java.lang.String[] days

### months

    public static final java.lang.String[] months

### conn

    public java.net.Socket conn

### connected

    public boolean connected

### is

    public java.io.BufferedInputStream is

### br

    public java.io.BufferedReader br

### os

    public java.io.BufferedOutputStream os

### write_content_length

    public int write_content_length

### read_header_date

    public java.lang.String read_header_date

### read_header_server

    public java.lang.String read_header_server

### read_header_charset

    public java.lang.String read_header_charset

### read_header_content_language

    public java.lang.String read_header_content_language

### read_header_content_type

    public java.lang.String read_header_content_type

### read_header_content_length

    public int read_header_content_length

### read_buffer

    public char[] read_buffer

### status

    public int status

### status_text

    public java.lang.String status_text

### version

    public java.lang.String version

### error

    public int error

### activity

    public int activity

### hostname

    public java.lang.String hostname

### port

    public int port

### path

    public java.lang.String path

### user

    public java.lang.String user

### passwd

    public java.lang.String passwd

### auth_type

    public java.lang.String auth_type

### realm

    public java.lang.String realm

### opaque

    public java.lang.String opaque

### nonce

    public java.lang.String nonce

### resource

    public java.lang.String resource

### method

    public java.lang.String method

### http_request

    public java.lang.String http_request

### http_content_length

    public int http_content_length

Constructor Detail

### IPPHttp

    public IPPHttp(java.lang.String request_url)
            throws java.io.IOException,
                   java.net.UnknownHostException

  Constructor using `URL`.
  Parameters:
    `request_url` - `URL` of server to connect to.

### IPPHttp

    public IPPHttp(java.lang.String request_url,
                   java.lang.String p_auth_type,
                   java.lang.String p_user,
                   java.lang.String p_passwd)
            throws java.io.IOException,
                   java.net.UnknownHostException

  Constructor using `URL, user and pass`.
  Parameters:
    `request_url` - `URL` of server to connect to.
    `p_auth_type` - `String` basic or digest.
    `p_user` - `String` User name.
    `p_passwd` - `String` password.

Method Detail

### reConnect

    public boolean reConnect()
                      throws java.io.IOException

  Re-establish a dropped connection.
  Returns:
    `boolean` True if connected.

### setUser

    public void setUser(java.lang.String p_user)

  Set the user name.
  Parameters:
    `p_user` - `String` - user name.

### setPassword

    public void setPassword(java.lang.String p_passwd)

  Set the password.
  Parameters:
    `p_passwd` - `String` - password.

### writeHeader

    public int writeHeader(java.lang.String request,
                           int content_length)
                    throws java.io.IOException

  Write the request header bytes to the server.
  Parameters:
    `request` - `String` - the request.
    `content_length` - `int` - size of the total request.

### checkForResponse

    public int checkForResponse()

### write

    public void write(byte[] bytes)
               throws java.io.IOException

  Write bytes to the output stream.
  Parameters:
    `bytes` - Array of bytes to write to the stream.

### write

    public void write(byte[] bytes,
                      int length)
               throws java.io.IOException

  Write bytes to the output stream.
  Parameters:
    `bytes` - Array of bytes to write to the stream.
    `length` - Number of bytes to write to the stream.

### read_header

    public int read_header()
                    throws java.io.IOException

  Read the HTTP header from the input stream.
  Returns:
    `int` Content length of response.

### read_line

    public java.lang.String read_line()
                               throws java.io.IOException

  Read a line from the input stream.
  Returns:
    `String` Line read.

### read

    public char[] read(int count)
                throws java.io.IOException

  Read up to `count` bytes from the input stream.
  Parameters:
    ``count`` - Number of bytes to read.
  Returns:
    `char[]` Character array of data read.

### processResponse

    public IPP processResponse()

  Process the HTTP response from the server.
  Returns:
    `IPP` IPP object containing response data.
  See Also:
    `IPP`, `IPPRequest`, `IPPAttribute`, `IPPValue`, `IPPDefs`

### parseAuthenticate

    public void parseAuthenticate(java.lang.String p_auth)