HeaderSet.java :  » UnTagged » meteoroid » javax » obex » Android Open Source

Android Open Source » UnTagged » meteoroid 
meteoroid » javax » obex » HeaderSet.java
package javax.obex;

/**
 * 
 * The <code>HeaderSet</code> interface defines the methods that set and get
 * the values of OBEX headers.
 * The following table describes how the headers specified in this interface are
 * represented in OBEX and in Java.  The Java types are used with the
 * <code>setHeader()</code> and <code>getHeader()</code> methods and specify the
 * type of object that must be provided and will be returned from these methods,
 * respectively.
 * <TABLE BORDER>
 * <TR><TH>Header Values</TH><TH>OBEX Representation</TH><TH>Java Type</TH></TR>
 * <TR><TD>COUNT</TD><TD>4 byte unsigned integer</TD>
 * <TD><code>java.lang.Long</code> in the range 0 to 2<sup>32</sup>-1</TD>
 * </TR>
 * <TR><TD>NAME</TD><TD>Unicode string</TD>
 * <TD><code>java.lang.String</code></TD></TR>
 * <TR><TD>TYPE</TD><TD>ASCII string</TD>
 * <TD><code>java.lang.String</code></TD></TR>
 * <TR><TD>LENGTH</TD><TD>4 byte unsigned integer</TD>
 * <TD><code>java.lang.Long</code> in the range 0 to 2<sup>32</sup>-1</TD>
 * </TR>
 * <TR><TD>TIME_ISO_8601</TD>
 * <TD>ASCII string of the form YYYYMMDDTHHMMSS[Z] where [Z] specifies Zulu
 * time</TD>
 * <TD><code>java.util.Calendar</code></TD></TR>
 * <TR><TD>TIME_4_BYTE</TD><TD>4 byte unsigned integer</TD>
 * <TD><code>java.util.Calendar</code></TD></TR>
 * <TR><TD>DESCRIPTION</TD><TD>Unicode string</TD>
 * <TD><code>java.lang.String</code></TD></TR>
 * <TR><TD>TARGET</TD><TD>byte sequence</TD>
 * <TD><code>byte[]</code></TD></TR>
 * <TR><TD>HTTP</TD><TD>byte sequence</TD>
 * <TD><code>byte[]</code></TD></TR>
 * <TR><TD>WHO</TD><TD>byte sequence</TD>
 * <TD><code>byte[]</code></TD></TR>
 * <TR><TD>OBJECT_CLASS</TD><TD>byte sequence</TD>
 * <TD><code>byte[]</code></TD></TR>
 * <TR><TD>APPLICATION_PARAMETER</TD><TD>byte sequence</TD>
 * <TD><code>byte[]</code></TD></TR>
 * </TABLE>
 * The <code>APPLICATION_PARAMETER</code> header requires some additional
 * explanation.  The byte array provided with the
 * <code>APPLICATION_PARAMETER</code> should be of the form Tag-Length-Value
 * according to the OBEX specification where Tag is a byte long, Length is a
 * byte long, and Value is up to 255 bytes long.  Multiple Tag-Length-Value
 * triples are allowed within a single <code>APPLICATION_PARAMETER</code>
 * header.  The implementation will NOT check this condition.  It is mentioned
 * only to allow for interoperability between OBEX implementations.
 * <STRONG>User Defined Headers</STRONG>
 * OBEX allows 64 user-defined header values.  Depending on the header
 * identifier provided, headers have different types.  The table below defines
 * the ranges and their types.
 * <TABLE BORDER>
 * <TR><TH>Header Identifier</TH><TH>Decimal Range</TH><TH>OBEX Type</TH>
 * <TH>Java Type</TH></TR>
 * <TR><TD>0x30 to 0x3F</TD><TD>48 to 63</TD><TD>Unicode String</TD>
 * <TD><code>java.lang.String</code></TD></TR>
 * <TR><TD>0x70 to 0x7F</TD><TD>112 to 127</TD><TD>byte sequence</TD>
 * <TD><code>byte[]</code></TD></TR>
 * <TR><TD>0xB0 to 0xBF</TD><TD>176 to 191</TD><TD>1 byte</TD>
 * <TD><code>java.lang.Byte</code></TD></TR>
 * <TR><TD>0xF0 to 0xFF</TD><TD>240 to 255</TD><TD>4 byte unsigned integer</TD>
 * <TD><code>java.lang.Long</code> in the range 0 to
 * 2<sup>32</sup>-1</TD></TR>
 * </TABLE>
 * 
 * <DD>1.2</DD>
 * <HR>
 * 
 * <!-- =========== FIELD SUMMARY =========== -->
 * 
 * <A NAME="field_summary"><!-- --></A>
 * <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
 * <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
 * <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
 * <B>Field Summary</B></FONT></TH>
 * </TR>
 * <TR BGCOLOR="white" CLASS="TableRowColor">
 * <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
 * <CODE>static&nbsp;int</CODE></FONT></TD>
 * <TD><CODE><B><A HREF="HeaderSet.html#APPLICATION_PARAMETER" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html#APPLICATION_PARAMETER">APPLICATION_PARAMETER</A></B></CODE>
 * 
 * <BR>
 * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents the OBEX Application Parameter header.</TD>
 * </TR>
 * <TR BGCOLOR="white" CLASS="TableRowColor">
 * <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
 * <CODE>static&nbsp;int</CODE></FONT></TD>
 * <TD><CODE><B><A HREF="HeaderSet.html#COUNT" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html#COUNT">COUNT</A></B></CODE>
 * 
 * <BR>
 * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents the OBEX Count header.</TD>
 * </TR>
 * <TR BGCOLOR="white" CLASS="TableRowColor">
 * <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
 * <CODE>static&nbsp;int</CODE></FONT></TD>
 * <TD><CODE><B><A HREF="HeaderSet.html#DESCRIPTION" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html#DESCRIPTION">DESCRIPTION</A></B></CODE>
 * 
 * <BR>
 * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents the OBEX Description header.</TD>
 * </TR>
 * <TR BGCOLOR="white" CLASS="TableRowColor">
 * <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
 * <CODE>static&nbsp;int</CODE></FONT></TD>
 * <TD><CODE><B><A HREF="HeaderSet.html#HTTP" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html#HTTP">HTTP</A></B></CODE>
 * 
 * <BR>
 * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents the OBEX HTTP header.</TD>
 * </TR>
 * <TR BGCOLOR="white" CLASS="TableRowColor">
 * <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
 * <CODE>static&nbsp;int</CODE></FONT></TD>
 * <TD><CODE><B><A HREF="HeaderSet.html#LENGTH" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html#LENGTH">LENGTH</A></B></CODE>
 * 
 * <BR>
 * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents the OBEX Length header.</TD>
 * </TR>
 * <TR BGCOLOR="white" CLASS="TableRowColor">
 * <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
 * <CODE>static&nbsp;int</CODE></FONT></TD>
 * <TD><CODE><B><A HREF="HeaderSet.html#NAME" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html#NAME">NAME</A></B></CODE>
 * 
 * <BR>
 * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents the OBEX Name header.</TD>
 * </TR>
 * <TR BGCOLOR="white" CLASS="TableRowColor">
 * <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
 * <CODE>static&nbsp;int</CODE></FONT></TD>
 * <TD><CODE><B><A HREF="HeaderSet.html#OBJECT_CLASS" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html#OBJECT_CLASS">OBJECT_CLASS</A></B></CODE>
 * 
 * <BR>
 * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents the OBEX Object Class header.</TD>
 * </TR>
 * <TR BGCOLOR="white" CLASS="TableRowColor">
 * <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
 * <CODE>static&nbsp;int</CODE></FONT></TD>
 * <TD><CODE><B><A HREF="HeaderSet.html#TARGET" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html#TARGET">TARGET</A></B></CODE>
 * 
 * <BR>
 * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents the OBEX Target header.</TD>
 * </TR>
 * <TR BGCOLOR="white" CLASS="TableRowColor">
 * <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
 * <CODE>static&nbsp;int</CODE></FONT></TD>
 * <TD><CODE><B><A HREF="HeaderSet.html#TIME_4_BYTE" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html#TIME_4_BYTE">TIME_4_BYTE</A></B></CODE>
 * 
 * <BR>
 * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents the OBEX Time header using the 4 byte representation.</TD>
 * </TR>
 * <TR BGCOLOR="white" CLASS="TableRowColor">
 * <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
 * <CODE>static&nbsp;int</CODE></FONT></TD>
 * <TD><CODE><B><A HREF="HeaderSet.html#TIME_ISO_8601" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html#TIME_ISO_8601">TIME_ISO_8601</A></B></CODE>
 * 
 * <BR>
 * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents the OBEX Time header using the ISO 8601 standards.</TD>
 * </TR>
 * <TR BGCOLOR="white" CLASS="TableRowColor">
 * <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
 * <CODE>static&nbsp;int</CODE></FONT></TD>
 * <TD><CODE><B><A HREF="HeaderSet.html#TYPE" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html#TYPE">TYPE</A></B></CODE>
 * 
 * <BR>
 * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents the OBEX Type header.</TD>
 * </TR>
 * <TR BGCOLOR="white" CLASS="TableRowColor">
 * <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
 * <CODE>static&nbsp;int</CODE></FONT></TD>
 * <TD><CODE><B><A HREF="HeaderSet.html#WHO" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html#WHO">WHO</A></B></CODE>
 * 
 * <BR>
 * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents the OBEX Who header.</TD>
 * </TR>
 * </TABLE>
 * &nbsp;
 * <!-- ========== METHOD SUMMARY =========== -->
 * 
 * <A NAME="method_summary"><!-- --></A>
 * <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
 * <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
 * <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
 * <B>Method Summary</B></FONT></TH>
 * </TR>
 * <TR BGCOLOR="white" CLASS="TableRowColor">
 * <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
 * <CODE>&nbsp;void</CODE></FONT></TD>
 * <TD><CODE><B><A HREF="HeaderSet.html#createAuthenticationChallenge(java.lang.String, boolean, boolean)" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html#createAuthenticationChallenge(java.lang.String, boolean, boolean)">createAuthenticationChallenge</A></B>(java.lang.String&nbsp;realm,
 * boolean&nbsp;userID,
 * boolean&nbsp;access)</CODE>
 * 
 * <BR>
 * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the authentication challenge header.</TD>
 * </TR>
 * <TR BGCOLOR="white" CLASS="TableRowColor">
 * <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
 * <CODE>&nbsp;java.lang.Object</CODE></FONT></TD>
 * <TD><CODE><B><A HREF="HeaderSet.html#getHeader(int)" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html#getHeader(int)">getHeader</A></B>(int&nbsp;headerID)</CODE>
 * 
 * <BR>
 * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Retrieves the value of the header identifier provided.</TD>
 * </TR>
 * <TR BGCOLOR="white" CLASS="TableRowColor">
 * <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
 * <CODE>&nbsp;int[]</CODE></FONT></TD>
 * <TD><CODE><B><A HREF="HeaderSet.html#getHeaderList()" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html#getHeaderList()">getHeaderList</A></B>()</CODE>
 * 
 * <BR>
 * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Retrieves the list of headers that may be retrieved via the
 * <code>getHeader</code> method that will not return <code>null</code>.</TD>
 * </TR>
 * <TR BGCOLOR="white" CLASS="TableRowColor">
 * <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
 * <CODE>&nbsp;int</CODE></FONT></TD>
 * <TD><CODE><B><A HREF="HeaderSet.html#getResponseCode()" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html#getResponseCode()">getResponseCode</A></B>()</CODE>
 * 
 * <BR>
 * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the response code received from the server.</TD>
 * </TR>
 * <TR BGCOLOR="white" CLASS="TableRowColor">
 * <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
 * <CODE>&nbsp;void</CODE></FONT></TD>
 * <TD><CODE><B><A HREF="HeaderSet.html#setHeader(int, java.lang.Object)" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html#setHeader(int, java.lang.Object)">setHeader</A></B>(int&nbsp;headerID,
 * java.lang.Object&nbsp;headerValue)</CODE>
 * 
 * <BR>
 * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the value of the header identifier to the value provided.</TD>
 * </TR>
 * </TABLE>
 * &nbsp;
 * 
 * <!-- ============ FIELD DETAIL =========== -->
 * 
 * <A NAME="field_detail"><!-- --></A>
 * <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
 * <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
 * <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
 * <B>Field Detail</B></FONT></TH>
 * </TR>
 * </TABLE>
 * 
 * <A NAME="COUNT"><!-- --></A><H3>
 * COUNT</H3>
 * <PRE>
 * static final int <B>COUNT</B></PRE>
 * <DD>Represents the OBEX Count header.  This allows the connection statement
 * to tell the server how many objects it plans to send or retrieve.
 * The value of <code>COUNT</code> is 0xC0 (192).
 * <HR>
 * 
 * <A NAME="NAME"><!-- --></A><H3>
 * NAME</H3>
 * <PRE>
 * static final int <B>NAME</B></PRE>
 * <DD>Represents the OBEX Name header.  This specifies the name of the object.
 * The value of <code>NAME</code> is 0x01 (1).
 * <HR>
 * 
 * <A NAME="TYPE"><!-- --></A><H3>
 * TYPE</H3>
 * <PRE>
 * static final int <B>TYPE</B></PRE>
 * <DD>Represents the OBEX Type header.  This allows a request to specify the
 * type of the object (e.g. text, html, binary, etc.).
 * The value of <code>TYPE</code> is 0x42 (66).
 * <HR>
 * 
 * <A NAME="LENGTH"><!-- --></A><H3>
 * LENGTH</H3>
 * <PRE>
 * static final int <B>LENGTH</B></PRE>
 * <DD>Represents the OBEX Length header.  This is the length of the object in
 * bytes.
 * The value of <code>LENGTH</code> is 0xC3 (195).
 * <HR>
 * 
 * <A NAME="TIME_ISO_8601"><!-- --></A><H3>
 * TIME_ISO_8601</H3>
 * <PRE>
 * static final int <B>TIME_ISO_8601</B></PRE>
 * <DD>Represents the OBEX Time header using the ISO 8601 standards.  This is
 * the preferred time header.
 * The value of <code>TIME_ISO_8601</code> is 0x44 (68).
 * <HR>
 * 
 * <A NAME="TIME_4_BYTE"><!-- --></A><H3>
 * TIME_4_BYTE</H3>
 * <PRE>
 * static final int <B>TIME_4_BYTE</B></PRE>
 * <DD>Represents the OBEX Time header using the 4 byte representation.  This
 * is only included for backwards compatibility.  It represents the number
 * of seconds since January 1, 1970.
 * The value of <code>TIME_4_BYTE</code> is 0xC4 (196).
 * <HR>
 * 
 * <A NAME="DESCRIPTION"><!-- --></A><H3>
 * DESCRIPTION</H3>
 * <PRE>
 * static final int <B>DESCRIPTION</B></PRE>
 * <DD>Represents the OBEX Description header.  This is a text description of
 * the object.
 * The value of <code>DESCRIPTION</code> is 0x05 (5).
 * <HR>
 * 
 * <A NAME="TARGET"><!-- --></A><H3>
 * TARGET</H3>
 * <PRE>
 * static final int <B>TARGET</B></PRE>
 * <DD>Represents the OBEX Target header.  This is the name of the service an
 * operation is targeted to.
 * The value of <code>TARGET</code> is 0x46 (70).
 * <HR>
 * 
 * <A NAME="HTTP"><!-- --></A><H3>
 * HTTP</H3>
 * <PRE>
 * static final int <B>HTTP</B></PRE>
 * <DD>Represents the OBEX HTTP header.  This allows an HTTP 1.X header to be
 * included in a request or reply.
 * The value of <code>HTTP</code> is 0x47 (71).
 * <HR>
 * 
 * <A NAME="WHO"><!-- --></A><H3>
 * WHO</H3>
 * <PRE>
 * static final int <B>WHO</B></PRE>
 * <DD>Represents the OBEX Who header.  Identifies the OBEX application to
 * determine if the two peers are talking to each other.
 * The value of <code>WHO</code> is 0x4A (74).
 * <HR>
 * 
 * <A NAME="OBJECT_CLASS"><!-- --></A><H3>
 * OBJECT_CLASS</H3>
 * <PRE>
 * static final int <B>OBJECT_CLASS</B></PRE>
 * <DD>Represents the OBEX Object Class header.  This header specifies the
 * OBEX object class of the object.
 * The value of <code>OBJECT_CLASS</code> is 0x4F (79).
 * <HR>
 * 
 * <A NAME="APPLICATION_PARAMETER"><!-- --></A><H3>
 * APPLICATION_PARAMETER</H3>
 * <PRE>
 * static final int <B>APPLICATION_PARAMETER</B></PRE>
 * <DD>Represents the OBEX Application Parameter header.  This header specifies
 * additional application request and response information.
 * The value of <code>APPLICATION_PARAMETER</code> is 0x4C (76).
 * 
 * <!-- ============ METHOD DETAIL ========== -->
 * 
 * <A NAME="method_detail"><!-- --></A>
 * <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
 * <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
 * <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
 * <B>Method Detail</B></FONT></TH>
 * </TR>
 * </TABLE>
 * 
 * <A NAME="setHeader(int, java.lang.Object)"><!-- --></A><H3>
 * setHeader</H3>
 * <PRE>
 * void <B>setHeader</B>(int&nbsp;headerID,
 * java.lang.Object&nbsp;headerValue)</PRE>
 * <DD>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 <code>null</code> is passed as the
 * <code>headerValue</code> then the header will be removed from the set of
 * headers to include in the next request.
 * <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the header identifier provided is
 * not one defined in this interface or a user-defined header; if the type
 * of <code>headerValue</code> is not the correct Java type as defined in
 * the description of this interface<DT><B>See Also:</B><DD><A HREF="HeaderSet.html#getHeader(int)" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html#getHeader(int)"><CODE>getHeader(int)</CODE></A></DL>
 * <HR>
 * 
 * <A NAME="getHeader(int)"><!-- --></A><H3>
 * getHeader</H3>
 * <PRE>
 * java.lang.Object <B>getHeader</B>(int&nbsp;headerID)
 * throws java.io.IOException</PRE>
 * <DD>Retrieves the value of the header identifier provided.  The type of the
 * Object returned is defined in the description of this interface.
 * header identifier specified is not part of this <code>HeaderSet</code>
 * object
 * <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the <code>headerID</code> is not
 * one defined in this interface or any of the user-defined headers
 * <DD><CODE>java.io.IOException</CODE> - if an error occurred in the transport layer during
 * the operation or if the connection has been closed<DT><B>See Also:</B><DD><A HREF="HeaderSet.html#setHeader(int, java.lang.Object)" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html#setHeader(int, java.lang.Object)"><CODE>setHeader(int, java.lang.Object)</CODE></A></DL>
 * <HR>
 * 
 * <A NAME="getHeaderList()"><!-- --></A><H3>
 * getHeaderList</H3>
 * <PRE>
 * int[] <B>getHeaderList</B>()
 * throws java.io.IOException</PRE>
 * <DD>Retrieves the list of headers that may be retrieved via the
 * <code>getHeader</code> method that will not return <code>null</code>.
 * In other words, this method returns all the headers that are available
 * in this object.
 * 
 * <code>null</code> if no headers are available
 * <DD><CODE>java.io.IOException</CODE> - if an error occurred in the transport layer during
 * the operation or the connection has been closed<DT><B>See Also:</B><DD><A HREF="HeaderSet.html#getHeader(int)" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html#getHeader(int)"><CODE>getHeader(int)</CODE></A></DL>
 * <HR>
 * 
 * <A NAME="createAuthenticationChallenge(java.lang.String, boolean, boolean)"><!-- --></A><H3>
 * createAuthenticationChallenge</H3>
 * <PRE>
 * void <B>createAuthenticationChallenge</B>(java.lang.String&nbsp;realm,
 * boolean&nbsp;userID,
 * boolean&nbsp;access)</PRE>
 * <DD>Sets the authentication challenge header.  The <code>realm</code> will
 * be encoded based upon the default encoding scheme used by the
 * implementation to encode strings.  Therefore, the encoding scheme used
 * to encode the <code>realm</code> is application dependent.
 * <code>null</code> no realm will be sent in the authentication challenge
 * header<DD><CODE>userID</CODE> - if <code>true</code>, a user ID is required in the reply;
 * if <code>false</code>, no user ID is required<DD><CODE>access</CODE> - if <code>true</code> then full access will be granted if
 * successful; if <code>false</code> then read-only access will be granted
 * if successful</DL>
 * <HR>
 * 
 * <A NAME="getResponseCode()"><!-- --></A><H3>
 * getResponseCode</H3>
 * <PRE>
 * int <B>getResponseCode</B>()
 * throws java.io.IOException</PRE>
 * <DD>Returns the response code received from the server.  Response codes
 * are defined in the <code>ResponseCodes</code> class.
 * 
 * <DD><CODE>java.io.IOException</CODE> - if an error occurred in the transport layer during
 * the transaction; if this method is called on a <code>HeaderSet</code>
 * object created by calling <code>createHeaderSet()</code> in a
 * <code>ClientSession</code> object; if an OBEX server created this object<DT><B>See Also:</B><DD><A HREF="ResponseCodes.html" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/ResponseCodes.html" title="class in javax.obex"><CODE>ResponseCodes</CODE></A></DL>
 * <!-- ========= END OF CLASS DATA ========= -->
 * <HR>
 * 
 * 
 * <!-- ======= START OF BOTTOM NAVBAR ====== -->
 * <A NAME="navbar_bottom"><!-- --></A>
 * <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
 * <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
 * <TR>
 * <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
 * <A NAME="navbar_bottom_firstrow"><!-- --></A>
 * <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
 * <TR ALIGN="center" VALIGN="top">
 * <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html" tppabs="http://java.sun.com/javame/reference/apis/jsr082/overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
 * <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
 * <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
 * <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
 * <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html" tppabs="http://java.sun.com/javame/reference/apis/jsr082/deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
 * <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html" tppabs="http://java.sun.com/javame/reference/apis/jsr082/index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
 * <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html" tppabs="http://java.sun.com/javame/reference/apis/jsr082/help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
 * </TR>
 * </TABLE>
 * </TD>
 * <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
 * <b>JSR 82</b></EM>
 * </TD>
 * </TR>
 * 
 * <TR>
 * <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
 * &nbsp;<A HREF="ClientSession.html" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/ClientSession.html" title="interface in javax.obex"><B>PREV CLASS</B></A>&nbsp;
 * &nbsp;<A HREF="Operation.html" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/Operation.html" title="interface in javax.obex"><B>NEXT CLASS</B></A></FONT></TD>
 * <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
 * <A HREF="../../index.html-javax-obex-HeaderSet.html" tppabs="http://java.sun.com/javame/reference/apis/jsr082/index.html?javax/obex/HeaderSet.html" target="_top"><B>FRAMES</B></A>  &nbsp;
 * &nbsp;<A HREF="HeaderSet.html" tppabs="http://java.sun.com/javame/reference/apis/jsr082/javax/obex/HeaderSet.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
 * &nbsp;<SCRIPT type="text/javascript">
 * <!--
 * if(window==top) {
 * document.writeln('<A HREF="../../allclasses-noframe.html"/
 * tpa=http://java.sun.com/javame/reference/apis/jsr082/allclasses-noframe.html/><B>All Classes</B></A>');
 * }
 * //-->
 * </SCRIPT>
 * <NOSCRIPT>
 * <A HREF="../../allclasses-noframe.html" tppabs="http://java.sun.com/javame/reference/apis/jsr082/allclasses-noframe.html"><B>All Classes</B></A>
 * </NOSCRIPT>
 * 
 * 
 * </FONT></TD>
 * </TR>
 * <TR>
 * <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
 * SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
 * <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
 * DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
 * </TR>
 * </TABLE>
 * <A NAME="skip-navbar_bottom"></A>
 * <!-- ======== END OF BOTTOM NAVBAR ======= -->
 * 
 * <HR>
 * <small>Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. <b>Use is subject to <a href="http://java.sun.com/javame/reference/apis/license.html" target="_top">License Terms</a>.</b> Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.<br><br>For more information, please consult the <a href="http://jcp.org/en/jsr/detail?id=82" target="_top">JSR 82 specification.</a></small>
 * </BODY>
 * <script language="JavaScript" src="../../../../../../js/omi/jsc/s_code_remote.js" tppabs="http://java.sun.com/js/omi/jsc/s_code_remote.js"></script></HTML>
 * 
 */
public interface HeaderSet
{
  /**
   * Represents the OBEX Count header.  This allows the connection statement
   * to tell the server how many objects it plans to send or retrieve.
   * <P>
   * The value of <code>COUNT</code> is 0xC0 (192).
   * <P>
   * <DT><B>See Also:</B>
   * 
   */
  static final int COUNT = 0xC0;

  /**
   * Represents the OBEX Name header.  This specifies the name of the object.
   * <P>
   * The value of <code>NAME</code> is 0x01 (1).
   * <P>
   * <DT><B>See Also:</B>
   * 
   */
  static final int NAME = 0x01;

  /**
   * Represents the OBEX Type header.  This allows a request to specify the
   * type of the object (e.g. text, html, binary, etc.).
   * <P>
   * The value of <code>TYPE</code> is 0x42 (66).
   * <P>
   * <DT><B>See Also:</B>
   * 
   */
  static final int TYPE = 0x42;

  /**
   * Represents the OBEX Length header.  This is the length of the object in
   * bytes.
   * <P>
   * The value of <code>LENGTH</code> is 0xC3 (195).
   * <P>
   * <DT><B>See Also:</B>
   * 
   */
  static final int LENGTH = 0xC3;

  /**
   * Represents the OBEX Time header using the ISO 8601 standards.  This is
   * the preferred time header.
   * <P>
   * The value of <code>TIME_ISO_8601</code> is 0x44 (68).
   * <P>
   * <DT><B>See Also:</B>
   * 
   */
  static final int TIME_ISO_8601 = 0x44;

  /**
   * Represents the OBEX Time header using the 4 byte representation.  This
   * is only included for backwards compatibility.  It represents the number
   * of seconds since January 1, 1970.
   * <P>
   * The value of <code>TIME_4_BYTE</code> is 0xC4 (196).
   * <P>
   * <DT><B>See Also:</B>
   * 
   */
  static final int TIME_4_BYTE = 0xC4;

  /**
   * Represents the OBEX Description header.  This is a text description of
   * the object.
   * <P>
   * The value of <code>DESCRIPTION</code> is 0x05 (5).
   * <P>
   * <DT><B>See Also:</B>
   * 
   */
  static final int DESCRIPTION = 0x05;

  /**
   * Represents the OBEX Target header.  This is the name of the service an
   * operation is targeted to.
   * <P>
   * The value of <code>TARGET</code> is 0x46 (70).
   * <P>
   * <DT><B>See Also:</B>
   * 
   */
  static final int TARGET = 0x46;

  /**
   * Represents the OBEX HTTP header.  This allows an HTTP 1.X header to be
   * included in a request or reply.
   * <P>
   * The value of <code>HTTP</code> is 0x47 (71).
   * <P>
   * <DT><B>See Also:</B>
   * 
   */
  static final int HTTP = 0x47;

  /**
   * Represents the OBEX Who header.  Identifies the OBEX application to
   * determine if the two peers are talking to each other.
   * <P>
   * The value of <code>WHO</code> is 0x4A (74).
   * <P>
   * <DT><B>See Also:</B>
   * 
   */
  static final int WHO = 0x4A;

  /**
   * Represents the OBEX Object Class header.  This header specifies the
   * OBEX object class of the object.
   * <P>
   * The value of <code>OBJECT_CLASS</code> is 0x4F (79).
   * <P>
   * <DT><B>See Also:</B>
   * 
   */
  static final int OBJECT_CLASS = 0x4F;

  /**
   * Represents the OBEX Application Parameter header.  This header specifies
   * additional application request and response information.
   * <P>
   * The value of <code>APPLICATION_PARAMETER</code> is 0x4C (76).
   * <P>
   * <DT><B>See Also:</B>
   * 
   * 
   */
  static final int APPLICATION_PARAMETER = 0x4C;

  

  /**
   * 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 <code>null</code> is passed as the
   * <code>headerValue</code> then the header will be removed from the set of
   * headers to include in the next request.
   * <P>
   * 
   * @param headerID - the identifier to include in the message
   * @param headerValue - the value of the header identifier
   * @throws java.lang.IllegalArgumentException - if the header identifier provided is not one defined in this interface or a user-defined header; if the type of headerValue is not the correct Java type as defined in the description of this interface
   * @see #getHeader(int)
   */
  void setHeader(int headerID, java.lang.Object headerValue);

  /**
   * Retrieves the value of the header identifier provided.  The type of the
   * Object returned is defined in the description of this interface.
   * <P>
   * 
   * @param headerID - the header identifier whose value is to be returned
   * @return the value of the header provided or null if the header identifier specified is not part of this HeaderSet object
   * @throws java.lang.IllegalArgumentException - if the headerID is not one defined in this interface or any of the user-defined headers
   * @throws java.io.IOException - if an error occurred in the transport layer during the operation or if the connection has been closed
   * @see #setHeader(int, java.lang.Object)
   */
  java.lang.Object getHeader(int headerID) throws java.io.IOException;

  /**
   * Retrieves the list of headers that may be retrieved via the
   * <code>getHeader</code> method that will not return <code>null</code>.
   * In other words, this method returns all the headers that are available
   * in this object.
   * <P>
   * 
   * 
   * @return the array of headers that are set in this object or null if no headers are available
   * @throws java.io.IOException - if an error occurred in the transport layer during the operation or the connection has been closed
   * @see #getHeader(int)
   */
  int[] getHeaderList() throws java.io.IOException;

  /**
   * Sets the authentication challenge header.  The <code>realm</code> will
   * be encoded based upon the default encoding scheme used by the
   * implementation to encode strings.  Therefore, the encoding scheme used
   * to encode the <code>realm</code> is application dependent.
   * <P>
   * 
   * @param realm - a short description that describes what password to use; if null no realm will be sent in the authentication challenge header
   * @param userID - if true, a user ID is required in the reply; if false, no user ID is required
   * @param access - if true then full access will be granted if successful; if false then read-only access will be granted if successful
   */
  void createAuthenticationChallenge(java.lang.String realm, boolean userID, boolean access);

  /**
   * Returns the response code received from the server.  Response codes
   * are defined in the <code>ResponseCodes</code> class.
   * <P>
   * 
   * 
   * @return 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 ResponseCodes
   */
  int getResponseCode() throws java.io.IOException;

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.