Java Reference
In-Depth Information
Table 12-5. OBEX Requests
OBEX Request
API Method
Description
HeaderSet connect(HeaderSet hdrs);
CONNECT
Connects and creates a session with the
OBEX server. Must be called successfully
before sending other requests. Returns a
HeaderSet . Uses getResponseCode() on the
HeaderSet to retrieve the server return code.
Operation put(HeaderSet hdrs);
Starts an OBEX PUT operation. Returns an
Operation object. Use this to obtain an
output stream that can be used to send
arbitrarily large objects.
PUT
Operation get(HeaderSet hdrs);
Starts an OBEX GET operation. Returns an
Operation object. Use this to obtain an
input stream that can be used to receive
arbitrarily large objects.
GET
HeaderSet delete(HeaderSet hdrs);
DELETE
Performs an OBEX DELETE request, typi-
cally used to delete an object on the server.
HeaderSet setpath(HeaderSet hdrs,
boolean backup, boolean create);
SETPATH
Instructs the server to change working
directory via an OBEX SETPATH request.
backup indicates whether the server
changes directory up one level before
setting the path. create indicates whether
the directory should be created if it does
not yet exists. Returns a HeaderSet .
HeaderSet disconnect(HeaderSet hdrs);
DISCONNECT
Disconnects from the current session using
an OBEX DISCONNECT request. Returns a
HeaderSet .
Communications Using Headers
Other than standard OBEX headers that are predefined in the Javadocs of the
javax.obex.HeaderSet interface (part of JSR 82), you can also create user-defined headers.
User-defined headers must have a header identifier value between 48 and 255 . In fact,
OBEX mandates that headers with a certain identifier must be of a certain type. Table 12-6
shows the range and corresponding type.
Table 12-6. OBEX User-Defined Header Types
Identifier Value
Java Type
Actual OBEX Type
String
48-63
Unicode string
byte[]
112-127
Byte sequence
Byte
176-191
Single 8-bit byte
240-255
Long (0 to 2 32 -1 only)
32-bits unsigned integer
 
Search WWH ::




Custom Search