Nokia Extensions for JSR-257

com.nokia.nfc.nxp.mfstd
Interface MFSectorTrailer

All Superinterfaces:
MFBlock, MFDataArea

public interface MFSectorTrailer
extends MFBlock

Provides access to a sector trailer.


Field Summary
 
Fields inherited from interface com.nokia.nfc.nxp.mfstd.MFBlock
BLOCK_LEN, BLOCKTYPE_DATA, BLOCKTYPE_MANUFACTURER, BLOCKTYPE_TRAILER, MAX_DIFF, MIN_DIFF
 
Method Summary
 MFTrailerContents readTrailerContents(MFKey key)
          Reads the contents of this sector trailer from the card using the given authentication key.
 void write(MFKey key, byte[] src, int dstOffset)
          Writes the given byte array src to this data area starting from dstOffset.
 void write(MFKey key, byte[] src, int srcOffset, int length, int dstOffset)
          Writes the given data to the data area starting at the byte offset dstOffset.
 void writeTrailerContents(MFKey key, MFTrailerContents contents)
          Writes new contents to this sector trailer block.
 void writeValue(MFKey key, MFValue newValue)
          Always throws a MFStandardException as the sector trailer cannot be used as a value block.
 
Methods inherited from interface com.nokia.nfc.nxp.mfstd.MFBlock
copyFrom, copyTo, decrement, getBlockIndex, getBlockType, increment, isValueBlock, readValue
 
Methods inherited from interface com.nokia.nfc.nxp.mfstd.MFDataArea
read, size, toString
 

Method Detail

readTrailerContents

MFTrailerContents readTrailerContents(MFKey key)
                                      throws MFStandardException,
                                             java.io.IOException
Reads the contents of this sector trailer from the card using the given authentication key.

Parameters:
key - the authentication key. If null then the device's default keys are used.
Returns:
contents of the trailer as a MFTrailerContents object.
Throws:
MFStandardException - if authentication fails.
java.io.IOException - if a connection error occurs.

writeTrailerContents

void writeTrailerContents(MFKey key,
                          MFTrailerContents contents)
                          throws MFStandardException,
                                 java.io.IOException
Writes new contents to this sector trailer block. All of the fields of the contents object must be set to non-null values.

Parameters:
key - the authentication key. If null then the device's default keys are used.
contents - the new sector trailer contents.
Throws:
MFStandardException - if authentication fails.
java.io.IOException - if a connection error occurs.
java.lang.NullPointerException - if any of the contents object's fields are null.

write

void write(MFKey key,
           byte[] src,
           int dstOffset)
           throws MFStandardException,
                  java.io.IOException

Writes the given byte array src to this data area starting from dstOffset.

Because partial writes are not supported for sector trailers the dstOffset must always be 0 and the src array length must always be 16. Otherwise an IllegalArgumentException will be thrown.

Specified by:
write in interface MFDataArea
Parameters:
key - the authentication key. If null then the device's default keys are used.
src - the data to write.
dstOffset - the offset in this data area.
Throws:
MFStandardException - if authentication fails.
java.io.IOException - if a connection error occurs.
java.lang.NullPointerException - if src is null.
java.lang.IllegalArgumentException - if the destination byte range is out of bounds.

write

void write(MFKey key,
           byte[] src,
           int srcOffset,
           int length,
           int dstOffset)
           throws MFStandardException,
                  java.io.IOException

Writes the given data to the data area starting at the byte offset dstOffset. The data to be written is read from the source array src starting at offset srcOffset.

Because partial writes are not supported for sector trailers the dstOffset must always be 0 and the length must always be 16. Otherwise an IllegalArgumentException will be thrown.

Specified by:
write in interface MFDataArea
Parameters:
key - the authentication key. If null then the device's default keys are used.
src - the source array.
srcOffset - the offset in the source array.
length - the number of bytes to read from the source array.
dstOffset - the offset in this data area.
Throws:
MFStandardException - if authentication fails or if the write conditions are not met.
java.io.IOException - if a connection error occurs.
java.lang.NullPointerException - if src is null.
java.lang.IllegalArgumentException - if either the source or destination byte range is out of bounds.

writeValue

void writeValue(MFKey key,
                MFValue newValue)
                throws MFStandardException,
                       java.io.IOException
Always throws a MFStandardException as the sector trailer cannot be used as a value block.

Specified by:
writeValue in interface MFBlock
Parameters:
key - the authentication key. If null then the device's default keys are used.
newValue - new value block contents
Throws:
MFStandardException - if authentication fails.
java.io.IOException - if a connection error occurs.
See Also:
MFBlock.writeValue(com.nokia.nfc.nxp.mfstd.MFKey, com.nokia.nfc.nxp.mfstd.MFValue)

Nokia Extensions for JSR-257

Copyright � 2010 Nokia Corporation. All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.