de.avetana.bluetooth.obex
Class OperationImpl

java.lang.Object
  extended byde.avetana.bluetooth.obex.OperationImpl
All Implemented Interfaces:
Connection, ContentConnection, InputConnection, Operation, OutputConnection, StreamConnection

public class OperationImpl
extends java.lang.Object
implements Operation


Nested Class Summary
protected  class OperationImpl.OBEXInputStream
          An own extension of the classical java InputStream class.
 
Constructor Summary
protected OperationImpl(CommandHandler con, HeaderSet hs, int opCode)
           
 
Method Summary
 void abort()
          Sends an ABORT message to the server.
 void close()
           
 java.lang.String getEncoding()
           
protected  HeaderSet getHeadersToSend()
           
 long getLength()
           
 HeaderSet getReceivedHeaders()
          Returns the headers that have been received during the operation.
 int getResponseCode()
          Returns the response code received from the server.
 java.lang.String getType()
           
protected  void newData(HeaderSet header)
           
 java.io.DataInputStream openDataInputStream()
           
 java.io.DataOutputStream openDataOutputStream()
           
 java.io.InputStream openInputStream()
           
 java.io.OutputStream openOutputStream()
           
 void sendHeaders(HeaderSet headers)
          Specifies the headers that should be sent in the next OBEX message that is sent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationImpl

protected OperationImpl(CommandHandler con,
                        HeaderSet hs,
                        int opCode)
                 throws java.io.IOException
Method Detail

abort

public void abort()
           throws java.io.IOException
Description copied from interface: Operation
Sends an ABORT message to the server. By calling this method, the corresponding input and output streams will be closed along with this object. No headers are sent in the abort request. This will end the operation since close() will be called by this method.

Specified by:
abort in interface Operation
Throws:
java.io.IOException - if the transaction has already ended or if an OBEX server calls this method

getReceivedHeaders

public HeaderSet getReceivedHeaders()
                             throws java.io.IOException
Description copied from interface: Operation
Returns the headers that have been received during the operation. Modifying the object returned has no effect on the headers that are sent or retrieved.

Specified by:
getReceivedHeaders in interface Operation
Returns:
the headers received during this Operation
Throws:
java.io.IOException - if this Operation has been closed

sendHeaders

public void sendHeaders(HeaderSet headers)
                 throws java.io.IOException
Description copied from interface: Operation
Specifies the headers that should be sent in the next OBEX message that is sent.

Specified by:
sendHeaders in interface Operation
Parameters:
headers - the headers to send in the next message
Throws:
java.io.IOException - if this Operation has been closed or the transaction has ended and no further messages will be exchanged

getHeadersToSend

protected HeaderSet getHeadersToSend()

getResponseCode

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

Specified by:
getResponseCode in interface Operation
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 object was created by an OBEX server
See Also:
ResponseCodes

getEncoding

public java.lang.String getEncoding()
Specified by:
getEncoding in interface ContentConnection

getLength

public long getLength()
Specified by:
getLength in interface ContentConnection

getType

public java.lang.String getType()
Specified by:
getType in interface ContentConnection

openDataInputStream

public java.io.DataInputStream openDataInputStream()
                                            throws java.io.IOException
Specified by:
openDataInputStream in interface InputConnection
Throws:
java.io.IOException

openInputStream

public java.io.InputStream openInputStream()
                                    throws java.io.IOException
Specified by:
openInputStream in interface InputConnection
Throws:
java.io.IOException

openDataOutputStream

public java.io.DataOutputStream openDataOutputStream()
                                              throws java.io.IOException
Specified by:
openDataOutputStream in interface OutputConnection
Throws:
java.io.IOException

openOutputStream

public java.io.OutputStream openOutputStream()
                                      throws java.io.IOException
Specified by:
openOutputStream in interface OutputConnection
Throws:
java.io.IOException

close

public void close()
Specified by:
close in interface Connection

newData

protected void newData(HeaderSet header)