javax.usb
Interface UsbStringDescriptor

All Superinterfaces:
UsbDescriptor

public interface UsbStringDescriptor
extends UsbDescriptor

Interface for a USB string descriptor.

Author:
Dan Streetman

Method Summary
 byte[] bString()
          Get this descriptor's bString.
 java.lang.String getString()
          Get this descriptor's translated String.
 
Methods inherited from interface javax.usb.UsbDescriptor
bDescriptorType, bLength
 

Method Detail

bString

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

Modifications to the returned byte[] will not affect the StringDescriptor's bString (i.e. a copy of the bString is returned).

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 translation is done using the best available Unicode encoding that this JVM provides. USB strings are 16-bit little-endian; if no 16-bit little-endian encoding is available, and the string can be converted to 8-bit (all high bytes are zero), then 8-bit encoding is used. If no encoding is available, an UnsupportedEncodingException is thrown.

For information about Unicode see the Unicode website.

Returns:
This descriptor's String.
Throws:
java.io.UnsupportedEncodingException - If no encoding is available.


Copyright © 2009 Eurotech Inc. All rights reserved.