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