com.ibm.jusb
Class UsbStringDescriptorImp

java.lang.Object
  extended by com.ibm.jusb.UsbDescriptorImp
      extended by com.ibm.jusb.UsbStringDescriptorImp
All Implemented Interfaces:
UsbDescriptor, UsbStringDescriptor

public class UsbStringDescriptorImp
extends UsbDescriptorImp
implements UsbStringDescriptor

UsbStringDescriptor implementation.

Author:
Dan Streetman

Field Summary
static java.lang.String[] ENCODING
          These are the encodings used to decode the USB String Descriptors.
static java.lang.String ENCODING_8BIT
          Fallback encoding if no 16-bit encoding is supported
 
Constructor Summary
UsbStringDescriptorImp(byte bLength, byte bDescriptorType, byte[] bString)
          Constructor.
 
Method Summary
 byte[] bString()
          Get this descriptor's bString.
 boolean equals(java.lang.Object object)
          Compare this to an Object.
 java.lang.String getString()
          Get this descriptor's translated String.
 
Methods inherited from class com.ibm.jusb.UsbDescriptorImp
bDescriptorType, bLength, hashCode, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.usb.UsbDescriptor
bDescriptorType, bLength
 

Field Detail

ENCODING

public static final java.lang.String[] ENCODING
These are the encodings used to decode the USB String Descriptors.

For all encodings supported by Java, see:

Java 1 (1.1) Supported Encodings

Java 2 (1.3) Supported Encodings

Java 2 (1.3) Required Encodings

The translation is done using the first available of these encodings:


ENCODING_8BIT

public static final java.lang.String ENCODING_8BIT
Fallback encoding if no 16-bit encoding is supported

See Also:
Constant Field Values
Constructor Detail

UsbStringDescriptorImp

public UsbStringDescriptorImp(byte bLength,
                              byte bDescriptorType,
                              byte[] bString)
Constructor.

Parameters:
bLength - This descriptor's bLength.
bDescriptorType - This descriptor's bDescriptorType.
bString - This descriptor's bString.
Method Detail

bString

public byte[] bString()
Get this descriptor's bString.

Specified by:
bString in interface UsbStringDescriptor
Returns:
This descriptor's bString.

getString

public java.lang.String getString()
                           throws java.io.UnsupportedEncodingException
Get this descriptor's translated String.

This is the String translation of the bString. The best available 16-bit encoding is used. If no 16-bit encoding is available, 8-bit encoding is used, unless any of the characters are 16 bit (high byte is non-zero); then 8-bit encoding is not used, and an UnsupportedEncodingException is thrown.

Specified by:
getString in interface UsbStringDescriptor
Returns:
This descriptor's String.
Throws:
java.io.UnsupportedEncodingException - If no encodings are available.

equals

public boolean equals(java.lang.Object object)
Compare this to an Object.

Overrides:
equals in class UsbDescriptorImp
Parameters:
object - The Object to compare to.
Returns:
If this is equal to the Object.