usb.jphoto
Class Container

java.lang.Object
  |
  +--usb.jphoto.Buffer
        |
        +--usb.jphoto.Container
Direct Known Subclasses:
Data, ParamVector

public abstract class Container
extends Buffer

PTP Command, Data, Response, and Event blocks use a "Generic Container Structure" as a packet header.

Note that since the string values to which various codes map have been interned, you may safely rely on "==" and "!=" when you make comparisons against constant values.


Method Summary
 int getBlockType()
          Returns the overall type of this data block as a coded integer.
static java.lang.String getBlockTypeName(int type)
          Returns an interned string, normally "command", "data", "response", or "event", corresponding to the coded type.
 int getCode()
          Returns the operation, response, or event code of this block.
 java.lang.String getCodeName(int code)
          Subclasses override this to map PTP codes to their names; the results are always interned strings, so that they can be efficiently compared ("=", "!=") against constants.
 java.lang.String getCodeString()
          Returns an interned string with name of this container's code.
static java.lang.String getCodeString(int code)
          Returns an interned string with the hexadecimal value of the specified container code.
static java.lang.String getCodeType(int code)
          Returns an interned string identifying the type of code field, such as "OperationCode", "ResponseCode", "ObjectFormatCode", "EventCode", or "DevicePropsCode".
 int getLength()
          Returns the overall length of this data block, including header.
 int getXID()
          Returns the ID of the transaction this block is associated with.
 java.lang.String toString()
          Provides a printable representation of data from the block header, including block type, code, and transaction ID.
 
Methods inherited from class usb.jphoto.Buffer
getS16, getS32, getS64, getS8, getString, getU16, getU8, nextS16, nextS16Array, nextS32, nextS32Array, nextS64, nextS64Array, nextS8, nextS8Array, nextString, nextU16, nextU16Array, nextU8, nextU8Array, put16, put32, put64, put8, putString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

toString

public java.lang.String toString()
Provides a printable representation of data from the block header, including block type, code, and transaction ID.
Overrides:
toString in class java.lang.Object

getLength

public int getLength()
Returns the overall length of this data block, including header.

getBlockType

public final int getBlockType()
Returns the overall type of this data block as a coded integer.

getBlockTypeName

public static final java.lang.String getBlockTypeName(int type)
Returns an interned string, normally "command", "data", "response", or "event", corresponding to the coded type. Unrecognized or undefined values are returned as interned Integer.toHexString values.

getCode

public final int getCode()
Returns the operation, response, or event code of this block.

getCodeType

public static final java.lang.String getCodeType(int code)
Returns an interned string identifying the type of code field, such as "OperationCode", "ResponseCode", "ObjectFormatCode", "EventCode", or "DevicePropsCode". Unrecognized or undefined values are returned as interned Integer.toHexString values.

getCodeName

public java.lang.String getCodeName(int code)
Subclasses override this to map PTP codes to their names; the results are always interned strings, so that they can be efficiently compared ("=", "!=") against constants. Such per-instance methods permit type-specific subclasses (and vendor extensions) to name their code values, invoking superclass methods to name all other codes.

getCodeString

public final java.lang.String getCodeString()
Returns an interned string with name of this container's code.

getCodeString

public static java.lang.String getCodeString(int code)
Returns an interned string with the hexadecimal value of the specified container code.

getXID

public final int getXID()
Returns the ID of the transaction this block is associated with.


Associated source code is licenced under the GPL.
See http://jphoto.sourceforge.net
This documentation was derived from that source code on 2001-04-12.