Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.javax.print.ipp
Class IppUtilities  view IppUtilities download IppUtilities.java

java.lang.Object
  extended bygnu.javax.print.ipp.IppUtilities

public final class IppUtilities
extends java.lang.Object

Collection of static utilities methods used in IPP response parsing and all over the place.

Also provides mapping from the attribute name values to the actual class object. Used to construct objects via reflection.


Field Summary
private static java.util.HashMap classesByName
           
private static java.util.HashMap instanceByClass
           
private static java.lang.Object[] INTEGER_ATT_VALUE
           
private static java.lang.Class[] INTEGER_CLASS_ARRAY
           
private static java.lang.Object[] TEXT_ATT_VALUE
           
private static java.lang.Class[] TEXT_CLASS_ARRAY
           
 
Constructor Summary
private IppUtilities()
           
 
Method Summary
static int convertToInt(byte[] b)
          Helper method to convert to an int.
static int convertToInt(byte b1, byte b2, byte b3, byte b4)
          Helper method to convert to an int.
static short convertToShort(byte b1, byte b2)
          Helper method to convert to a short.
static java.lang.Class getClass(java.lang.String name)
          Returns the implementing class object for given attribute name objects.
static javax.print.attribute.Attribute getEnumAttribute(java.lang.String name, java.lang.Object value)
          Instantiates an EnumSyntax based attribute with the given IPP name and the given value (Enums maybe int or String based).
static javax.print.attribute.Attribute getIntegerAttribute(java.lang.String name, int value)
          Instantiates an IntegerSyntax based attribute with the given IPP name for the given int value.
static java.lang.String getSupportedAttrName(java.lang.Class clazz)
          Returns the name of the supported attribute based on the given standard attribute category.
static java.lang.Class getSupportedCategory(java.lang.Class clazz)
          Returns the category of the supported attribute based on the given standard attribute category.
static javax.print.attribute.Attribute getTextAttribute(java.lang.String name, byte tag, byte[] value)
          Instantiates an TextSyntax based attribute with the given IPP name for the given text value (will be decoded).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTEGER_ATT_VALUE

private static java.lang.Object[] INTEGER_ATT_VALUE

INTEGER_CLASS_ARRAY

private static java.lang.Class[] INTEGER_CLASS_ARRAY

TEXT_ATT_VALUE

private static java.lang.Object[] TEXT_ATT_VALUE

TEXT_CLASS_ARRAY

private static java.lang.Class[] TEXT_CLASS_ARRAY

classesByName

private static java.util.HashMap classesByName

instanceByClass

private static java.util.HashMap instanceByClass
Constructor Detail

IppUtilities

private IppUtilities()
Method Detail

getClass

public static java.lang.Class getClass(java.lang.String name)
Returns the implementing class object for given attribute name objects.


getSupportedAttrName

public static java.lang.String getSupportedAttrName(java.lang.Class clazz)
Returns the name of the supported attribute based on the given standard attribute category.


getSupportedCategory

public static java.lang.Class getSupportedCategory(java.lang.Class clazz)
Returns the category of the supported attribute based on the given standard attribute category.


convertToInt

public static int convertToInt(byte[] b)
Helper method to convert to an int.


convertToInt

public static int convertToInt(byte b1,
                               byte b2,
                               byte b3,
                               byte b4)
Helper method to convert to an int.


convertToShort

public static short convertToShort(byte b1,
                                   byte b2)
Helper method to convert to a short.


getEnumAttribute

public static javax.print.attribute.Attribute getEnumAttribute(java.lang.String name,
                                                               java.lang.Object value)
Instantiates an EnumSyntax based attribute with the given IPP name and the given value (Enums maybe int or String based).


getIntegerAttribute

public static javax.print.attribute.Attribute getIntegerAttribute(java.lang.String name,
                                                                  int value)
Instantiates an IntegerSyntax based attribute with the given IPP name for the given int value.


getTextAttribute

public static javax.print.attribute.Attribute getTextAttribute(java.lang.String name,
                                                               byte tag,
                                                               byte[] value)
Instantiates an TextSyntax based attribute with the given IPP name for the given text value (will be decoded).