001: package com.etymon.pj.object;
002:
003: import java.io.*;
004:
005: /**
006: A representation of the PDF name type.
007: @author Nassib Nassar
008: */
009: public class PjName extends PjObject {
010:
011: /**
012: Creates a name object.
013: @param s the string value to initialize this object to.
014: */
015: public PjName(String s) {
016: _s = s;
017: }
018:
019: /**
020: Returns the string value of this object.
021: @return the string value of this object.
022: */
023: public String getString() {
024: return _s;
025: }
026:
027: /**
028: Writes this name to a stream in PDF format.
029: @param os the stream to write to.
030: @return the number of bytes written.
031: @exception IOException if an I/O error occurs.
032: */
033: public long writePdf(OutputStream os) throws IOException {
034: long z = write(os, "/");
035: int length = _s.length();
036: char c;
037: for (int x = 0; x < length; x++) {
038: c = _s.charAt(x);
039: if (Character.isISOControl(c)) {
040: z = z + write(os, "#" + Integer.toHexString((int) c));
041: } else {
042: z = z + write(os, c);
043: }
044: }
045: return z;
046: }
047:
048: /**
049: Returns a string representation of this name in PDF format.
050: @return the string representation.
051: public String toString() {
052: StringBuffer sb = new StringBuffer("/");
053: int length = _s.length();
054: char c;
055: for (int x = 0; x < length; x++) {
056: c = _s.charAt(x);
057: if (Character.isISOControl(c)) {
058: sb.append("#" + Integer.toHexString((int)c));
059: } else {
060: sb.append(c);
061: }
062: }
063: return sb.toString();
064: }
065: */
066:
067: /**
068: Compares two PjName objects for equality.
069: @param obj the reference object to compare to.
070: @return true if this object is the same as obj, false
071: otherwise.
072: */
073: public boolean equals(Object obj) {
074: if (obj == null) {
075: return false;
076: }
077: if (obj instanceof PjName) {
078: return _s.equals(((PjName) obj)._s);
079: } else {
080: return false;
081: }
082: }
083:
084: /**
085: Returns a deep copy of this object.
086: @return a deep copy of this object.
087: */
088: public Object clone() {
089: return this ;
090: }
091:
092: /**
093: Returns a hash code value for the object.
094: @return a hashcode value for this object.
095: */
096: public int hashCode() {
097: return _s.hashCode();
098: }
099:
100: public static final PjName AA = new PjName("AA");
101: public static final PjName ACROFORM = new PjName("AcroForm");
102: public static final PjName ANNOTS = new PjName("Annots");
103: public static final PjName AP = new PjName("AP");
104: public static final PjName ASCENT = new PjName("Ascent");
105: public static final PjName ASCII85DECODE = new PjName(
106: "ASCII85Decode");
107: public static final PjName ASCIIHEXDECODE = new PjName(
108: "ASCIIHexDecode");
109: public static final PjName AUTHOR = new PjName("Author");
110: public static final PjName AVGWIDTH = new PjName("AvgWidth");
111: public static final PjName B = new PjName("B");
112: public static final PjName BASEENCODING = new PjName("BaseEncoding");
113: public static final PjName BASEFONT = new PjName("BaseFont");
114: public static final PjName CAPHEIGHT = new PjName("CapHeight");
115: public static final PjName CATALOG = new PjName("Catalog");
116: public static final PjName CCITTFAXDECODE = new PjName(
117: "CCITTFaxDecode");
118: public static final PjName CHARSET = new PjName("CharSet");
119: public static final PjName COLORSPACE = new PjName("ColorSpace");
120: public static final PjName CONTENTS = new PjName("Contents");
121: public static final PjName COUNT = new PjName("Count");
122: public static final PjName CREATIONDATE = new PjName("CreationDate");
123: public static final PjName CREATOR = new PjName("Creator");
124: public static final PjName CROPBOX = new PjName("CropBox");
125: public static final PjName DA = new PjName("DA");
126: public static final PjName DCTDECODE = new PjName("DCTDecode");
127: public static final PjName DECODEPARMS = new PjName("DecodeParms");
128: public static final PjName DESCENT = new PjName("Descent");
129: public static final PjName DESTS = new PjName("Dests");
130: public static final PjName DIFFERENCES = new PjName("Differences");
131: public static final PjName DR = new PjName("DR");
132: public static final PjName DUR = new PjName("Dur");
133: public static final PjName DV = new PjName("DV");
134: public static final PjName ENCODING = new PjName("Encoding");
135: public static final PjName ENCRYPT = new PjName("Encrypt");
136: public static final PjName EXTGSTATE = new PjName("ExtGState");
137: public static final PjName F = new PjName("F");
138: public static final PjName FDECODEPARMS = new PjName("FDecodeParms");
139: public static final PjName FIELDS = new PjName("Fields");
140: public static final PjName FF = new PjName("Ff");
141: public static final PjName FFILTER = new PjName("FFilter");
142: public static final PjName FILTER = new PjName("Filter");
143: public static final PjName FIRSTCHAR = new PjName("FirstChar");
144: public static final PjName FLAGS = new PjName("Flags");
145: public static final PjName FLATEDECODE = new PjName("FlateDecode");
146: public static final PjName FONT = new PjName("Font");
147: public static final PjName FONTBBOX = new PjName("FontBBox");
148: public static final PjName FONTDESCRIPTOR = new PjName(
149: "FontDescriptor");
150: public static final PjName FONTFILE = new PjName("FontFile");
151: public static final PjName FONTFILE2 = new PjName("FontFile2");
152: public static final PjName FONTFILE3 = new PjName("FontFile3");
153: public static final PjName FONTNAME = new PjName("FontName");
154: public static final PjName FT = new PjName("FT");
155: public static final PjName H = new PjName("H");
156: public static final PjName HID = new PjName("Hid");
157: public static final PjName I = new PjName("I");
158: public static final PjName ID = new PjName("ID");
159: public static final PjName IMAGEB = new PjName("ImageB");
160: public static final PjName IMAGEC = new PjName("ImageC");
161: public static final PjName IMAGEI = new PjName("ImageI");
162: public static final PjName INFO = new PjName("Info");
163: public static final PjName ITALICANGLE = new PjName("ItalicAngle");
164: public static final PjName KEYWORDS = new PjName("Keywords");
165: public static final PjName KIDS = new PjName("Kids");
166: public static final PjName LASTCHAR = new PjName("LastChar");
167: public static final PjName LEADING = new PjName("Leading");
168: public static final PjName LENGTH = new PjName("Length");
169: public static final PjName LZWDECODE = new PjName("LZWDecode");
170: public static final PjName MAXLEN = new PjName("MaxLen");
171: public static final PjName MAXWIDTH = new PjName("MaxWidth");
172: public static final PjName MEDIABOX = new PjName("MediaBox");
173: public static final PjName MISSINGWIDTH = new PjName("MissingWidth");
174: public static final PjName MODDATE = new PjName("ModDate");
175: public static final PjName N = new PjName("N");
176: public static final PjName NAME = new PjName("Name");
177: public static final PjName NAMES = new PjName("Names");
178: public static final PjName O = new PjName("O");
179: public static final PjName OPENACTION = new PjName("OpenAction");
180: public static final PjName OPT = new PjName("Opt");
181: public static final PjName OUTLINES = new PjName("Outlines");
182: public static final PjName P = new PjName("P");
183: public static final PjName PAGE = new PjName("Page");
184: public static final PjName PAGEMODE = new PjName("PageMode");
185: public static final PjName PAGES = new PjName("Pages");
186: public static final PjName PARENT = new PjName("Parent");
187: public static final PjName PATTERN = new PjName("Pattern");
188: public static final PjName PDF = new PjName("PDF");
189: public static final PjName PREV = new PjName("Prev");
190: public static final PjName PROCSET = new PjName("ProcSet");
191: public static final PjName PRODUCER = new PjName("Producer");
192: public static final PjName PROPERTIES = new PjName("Properties");
193: public static final PjName Q = new PjName("Q");
194: public static final PjName RECT = new PjName("Rect");
195: public static final PjName RESOURCES = new PjName("Resources");
196: public static final PjName ROOT = new PjName("Root");
197: public static final PjName ROTATE = new PjName("Rotate");
198: public static final PjName RUNLENGTHDECODE = new PjName(
199: "RunLengthDecode");
200: public static final PjName STEMH = new PjName("StemH");
201: public static final PjName STEMV = new PjName("StemV");
202: public static final PjName SUBJECT = new PjName("Subject");
203: public static final PjName SUBTYPE = new PjName("Subtype");
204: public static final PjName TEXT = new PjName("Text");
205: public static final PjName THUMB = new PjName("Thumb");
206: public static final PjName THREADS = new PjName("Threads");
207: public static final PjName TITLE = new PjName("Title");
208: public static final PjName TOPINDEX = new PjName("TopIndex");
209: public static final PjName TRANS = new PjName("Trans");
210: public static final PjName TYPE = new PjName("Type");
211: public static final PjName TYPE1 = new PjName("Type1");
212: public static final PjName URI = new PjName("URI");
213: public static final PjName V = new PjName("V");
214: public static final PjName VIEWERPREFERENCES = new PjName(
215: "VIEWERPREFERENCES");
216: public static final PjName W = new PjName("W");
217: public static final PjName WIDTHS = new PjName("Widths");
218: public static final PjName XHEIGHT = new PjName("XHeight");
219: public static final PjName XOBJECT = new PjName("XObject");
220:
221: private String _s;
222:
223: }
|