uicc.connection
Interface DataReceived

All Superinterfaces:
Event

public interface DataReceived
extends Event

This event notifies a UICCTransportLink, BIPLink or SCP81Connection about data reception. The object implementing DataReceived interface is a Temporary Entry Point Object.


Method Summary
 short copyReceivedData(int srcOffset, byte[] dstBuffer, short dstOffset, short dstLength)
          Copy the received data in a buffer.
 void discardRemainingData()
          Discard data that have not been already read.
 int getReceivedDataLength()
          Returns the amount of data received, or -1 if data length is unknown (chunked transfer encoding is used), or 0 if all received data have been read or discarded by the Observer.
 boolean responseIsComplete()
          This method provides information if the transfer of the HTTP POST response was completely received.
 
Methods inherited from interface uicc.connection.Event
getObservable
 

Method Detail

getReceivedDataLength

int getReceivedDataLength()
Returns the amount of data received, or -1 if data length is unknown (chunked transfer encoding is used), or 0 if all received data have been read or discarded by the Observer.


copyReceivedData

short copyReceivedData(int srcOffset,
                       byte[] dstBuffer,
                       short dstOffset,
                       short dstLength)
Copy the received data in a buffer. Data are handled as a stream, and are received upon applet request. It is not possible to move backward in the data by using the srcOffset>/code> parameter. This is a non-blocking methid.

Parameters:
srcOffset - the offset of the first byte to copy in the received data
dstBuffer - a reference to the destination buffer
dstOffset - the position in the destination buffer
dstLength - the data length to be copied
Returns:
dstOffset+length of the copied value
Throws:
java.lang.NullPointerException - if dstBuffer is null
java.lang.ArrayIndexOutOfBoundsException - if dstOffset or dstLength or both would cause access outside array bounds, or if dstLength is negative.
ConnectionException - with the following reason code:
  • OUT_OF_DATA_BOUNDARIES if srcOffset or dstOffset or dstLength would cause access outside received data.
  • INVALID_PARAMETER if the requested srcOffset could not be reached.
java.lang.NullPointerException - if dstBuffer is equal to null

responseIsComplete

boolean responseIsComplete()
This method provides information if the transfer of the HTTP POST response was completely received.

Returns:
true if this fragment is the last or only fragment of the response data, false if the transfer is not yet complete (e.g. more data is expected in transfer coding chunked).

discardRemainingData

void discardRemainingData()
Discard data that have not been already read. Once invoked, no data could be read anymore.
This method is blocking until all data have been received by the underlying connection.

Throws:
ConnectionException - with the following reason code:
  • OPERATION_NOT_ALLOWED if all data have already been received or discarded.