1. /*
  2. * @(#)Compression.java 1.5 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.print.attribute.standard;
  8. import javax.print.attribute.EnumSyntax;
  9. import javax.print.attribute.DocAttribute;
  10. /**
  11. * Class Compression is a printing attribute class, an enumeration, that
  12. * specifies how print data is compressed. Compression is an attribute of the
  13. * print data (the doc), not of the Print Job. If a Compression attribute is not
  14. * specified for a doc, the printer assumes the doc's print data is uncompressed
  15. * (i.e., the default Compression value is always {@link #NONE
  16. * <CODE>NONE</CODE>}).
  17. * <P>
  18. * <B>IPP Compatibility:</B> The category name returned by
  19. * <CODE>getName()</CODE> is the IPP attribute name. The enumeration's
  20. * integer value is the IPP enum value. The <code>toString()</code> method
  21. * returns the IPP string representation of the attribute value.
  22. * <P>
  23. *
  24. * @author Alan Kaminsky
  25. */
  26. public class Compression extends EnumSyntax implements DocAttribute {
  27. /**
  28. * No compression is used.
  29. */
  30. public static final Compression NONE = new Compression(0);
  31. /**
  32. * ZIP public domain inflate/deflate compression technology.
  33. */
  34. public static final Compression DEFLATE = new Compression(1);
  35. /**
  36. * GNU zip compression technology described in
  37. * <A HREF="http://www.ietf.org/rfc/rfc1952.txt">RFC 1952</A>.
  38. */
  39. public static final Compression GZIP = new Compression(2);
  40. /**
  41. * UNIX compression technology.
  42. */
  43. public static final Compression COMPRESS = new Compression(3);
  44. /**
  45. * Construct a new compression enumeration value with the given integer
  46. * value.
  47. *
  48. * @param value Integer value.
  49. */
  50. protected Compression(int value) {
  51. super(value);
  52. }
  53. private static final String[] myStringTable = {"none",
  54. "deflate",
  55. "gzip",
  56. "compress"};
  57. private static final Compression[] myEnumValueTable = {NONE,
  58. DEFLATE,
  59. GZIP,
  60. COMPRESS};
  61. /**
  62. * Returns the string table for class Compression.
  63. */
  64. protected String[] getStringTable() {
  65. return (String[])myStringTable.clone();
  66. }
  67. /**
  68. * Returns the enumeration value table for class Compression.
  69. */
  70. protected EnumSyntax[] getEnumValueTable() {
  71. return (EnumSyntax[])myEnumValueTable.clone();
  72. }
  73. /**
  74. * Get the printing attribute class which is to be used as the "category"
  75. * for this printing attribute value.
  76. * <P>
  77. * For class Compression and any vendor-defined subclasses, the category is
  78. * class Compression itself.
  79. *
  80. * @return Printing attribute class (category), an instance of class
  81. * {@link java.lang.Class java.lang.Class}.
  82. */
  83. public final Class getCategory() {
  84. return Compression.class;
  85. }
  86. /**
  87. * Get the name of the category of which this attribute value is an
  88. * instance.
  89. * <P>
  90. * For class Compression and any vendor-defined subclasses, the category
  91. * name is <CODE>"compression"</CODE>.
  92. *
  93. * @return Attribute category name.
  94. */
  95. public final String getName() {
  96. return "compression";
  97. }
  98. }