de.avetana.bluetooth.obex
Class HeaderSetImpl

java.lang.Object
  extended by de.avetana.bluetooth.obex.HeaderSetImpl
All Implemented Interfaces:
HeaderSet

public class HeaderSetImpl
extends java.lang.Object
implements HeaderSet


Field Summary
static int AUTH_CHALLENGE
           
static int AUTH_RESPONSE
           
static int CONNECTION_ID
           
 
Fields inherited from interface javax.obex.HeaderSet
APPLICATION_PARAMETER, COUNT, DESCRIPTION, HTTP, LENGTH, NAME, OBJECT_CLASS, TARGET, TIME_4_BYTE, TIME_ISO_8601, TYPE, WHO
 
Constructor Summary
HeaderSetImpl()
           
 
Method Summary
 void createAuthenticationChallenge(java.lang.String realm, boolean userID, boolean access)
          Sets the authentication challenge header.
static byte[] createAuthResponse(byte[] challenge, Authenticator auth)
           
 java.lang.Object getHeader(int headerID)
          Retrieves the value of the header identifier provided.
 int[] getHeaderList()
          Retrieves the list of headers that may be retrieved via the getHeader method that will not return null.
 int getResponseCode()
          Returns the response code received from the server.
 void setHeader(int headerID, java.lang.Object headerValue)
          Sets the value of the header identifier to the value provided.
protected  void setRespCode(byte code)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONNECTION_ID

public static final int CONNECTION_ID
See Also:
Constant Field Values

AUTH_CHALLENGE

public static final int AUTH_CHALLENGE
See Also:
Constant Field Values

AUTH_RESPONSE

public static final int AUTH_RESPONSE
See Also:
Constant Field Values
Constructor Detail

HeaderSetImpl

public HeaderSetImpl()
Method Detail

setHeader

public void setHeader(int headerID,
                      java.lang.Object headerValue)
Description copied from interface: HeaderSet
Sets the value of the header identifier to the value provided. The type of object must correspond to the Java type defined in the description of this interface. If null is passed as the headerValue then the header will be removed from the set of headers to include in the next request.

Specified by:
setHeader in interface HeaderSet
Parameters:
headerID - the identifier to include in the message
headerValue - the value of the header identifier

getHeader

public java.lang.Object getHeader(int headerID)
Description copied from interface: HeaderSet
Retrieves the value of the header identifier provided. The type of the Object returned is defined in the description of this interface.

Specified by:
getHeader in interface HeaderSet
Parameters:
headerID - the header identifier whose value is to be returned
Returns:
the value of the header provided or null if the header identifier specified is not part of this HeaderSet object

getHeaderList

public int[] getHeaderList()
Description copied from interface: HeaderSet
Retrieves the list of headers that may be retrieved via the getHeader method that will not return null. In other words, this method returns all the headers that are available in this object.

Specified by:
getHeaderList in interface HeaderSet
Returns:
the array of headers that are set in this object or null if no headers are available
See Also:
HeaderSet.getHeader(int)

createAuthenticationChallenge

public void createAuthenticationChallenge(java.lang.String realm,
                                          boolean userID,
                                          boolean access)
Description copied from interface: HeaderSet
Sets the authentication challenge header. The realm will be encoded based upon the default encoding scheme used by the implementation to encode strings. Therefore, the encoding scheme used to encode the realm is application dependent.

Specified by:
createAuthenticationChallenge in interface HeaderSet
Parameters:
realm - a short description that describes what password to use; if null no realm will be sent in the authentication challenge header
userID - if true, a user ID is required in the reply; if false, no user ID is required
access - if true then full access will be granted if successful; if false then read-only access will be granted if successful

createAuthResponse

public static byte[] createAuthResponse(byte[] challenge,
                                        Authenticator auth)
Parameters:
hs -
Returns:

getResponseCode

public int getResponseCode()
                    throws java.io.IOException
Description copied from interface: HeaderSet
Returns the response code received from the server. Response codes are defined in the ResponseCodes class.

Specified by:
getResponseCode in interface HeaderSet
Returns:
the response code retrieved from the server
Throws:
java.io.IOException - if an error occurred in the transport layer during the transaction; if this method is called on a HeaderSet object created by calling createHeaderSet() in a ClientSession object; if an OBEX server created this object
See Also:
ResponseCodes

setRespCode

protected void setRespCode(byte code)