JAL-1807 test
[jalviewjs.git] / bin / javajs / export / PDFObject.js
index 2752622..ad20c61 100644 (file)
-Clazz.declarePackage ("javajs.export");\r
-Clazz.load (["javajs.util.SB"], "javajs.export.PDFObject", ["java.io.ByteArrayOutputStream", "java.util.Hashtable", "$.Map", "java.util.zip.Deflater", "$.DeflaterOutputStream"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.dictionary = null;\r
-this.stream = null;\r
-this.index = 0;\r
-this.type = null;\r
-this.len = 0;\r
-this.pt = 0;\r
-Clazz.instantialize (this, arguments);\r
-}, javajs["export"], "PDFObject", javajs.util.SB);\r
-Clazz.makeConstructor (c$, \r
-function (index) {\r
-Clazz.superConstructor (this, javajs["export"].PDFObject, []);\r
-this.index = index;\r
-}, "~N");\r
-Clazz.defineMethod (c$, "getRef", \r
-function () {\r
-return this.index + " 0 R";\r
-});\r
-Clazz.defineMethod (c$, "getID", \r
-function () {\r
-return this.type.substring (0, 1) + this.index;\r
-});\r
-Clazz.defineMethod (c$, "isFont", \r
-function () {\r
-return "Font".equals (this.type);\r
-});\r
-Clazz.defineMethod (c$, "setStream", \r
-function (stream) {\r
-this.stream = stream;\r
-}, "~A");\r
-Clazz.defineMethod (c$, "getDef", \r
-function (key) {\r
-return this.dictionary.get (key);\r
-}, "~S");\r
-Clazz.defineMethod (c$, "addDef", \r
-function (key, value) {\r
-if (this.dictionary == null) this.dictionary =  new java.util.Hashtable ();\r
-this.dictionary.put (key, value);\r
-if (key.equals ("Type")) this.type = (value).substring (1);\r
-}, "~S,~O");\r
-Clazz.defineMethod (c$, "setAsStream", \r
-function () {\r
-this.stream = this.toBytes (0, -1);\r
-this.setLength (0);\r
-});\r
-Clazz.defineMethod (c$, "output", \r
-function (os) {\r
-if (this.index > 0) {\r
-var s = this.index + " 0 obj\n";\r
-this.write (os, s.getBytes (), 0);\r
-}var streamLen = 0;\r
-if (this.dictionary != null) {\r
-if (this.dictionary.containsKey ("Length")) {\r
-if (this.stream == null) this.setAsStream ();\r
-streamLen = this.stream.length;\r
-var doDeflate = (streamLen > 1000);\r
-if (doDeflate) {\r
-var deflater =  new java.util.zip.Deflater (9);\r
-var outBytes =  new java.io.ByteArrayOutputStream (1024);\r
-var compBytes =  new java.util.zip.DeflaterOutputStream (outBytes, deflater);\r
-compBytes.write (this.stream, 0, streamLen);\r
-compBytes.finish ();\r
-this.stream = outBytes.toByteArray ();\r
-this.dictionary.put ("Filter", "/FlateDecode");\r
-streamLen = this.stream.length;\r
-}this.dictionary.put ("Length", "" + streamLen);\r
-}this.write (os, this.getDictionaryText (this.dictionary, "\n").getBytes (), 0);\r
-}if (this.length () > 0) this.write (os, this.toString ().getBytes (), 0);\r
-if (this.stream != null) {\r
-this.write (os, "stream\r\n".getBytes (), 0);\r
-this.write (os, this.stream, streamLen);\r
-this.write (os, "\r\nendstream\r\n".getBytes (), 0);\r
-}if (this.index > 0) this.write (os, "endobj\n".getBytes (), 0);\r
-return this.len;\r
-}, "java.io.OutputStream");\r
-Clazz.defineMethod (c$, "write", \r
-($fz = function (os, bytes, nBytes) {\r
-if (nBytes == 0) nBytes = bytes.length;\r
-this.len += nBytes;\r
-os.write (bytes, 0, nBytes);\r
-}, $fz.isPrivate = true, $fz), "java.io.OutputStream,~A,~N");\r
-Clazz.defineMethod (c$, "getDictionaryText", \r
-($fz = function (d, nl) {\r
-var sb =  new javajs.util.SB ();\r
-sb.append ("<<");\r
-if (d.containsKey ("Type")) sb.append ("/Type").appendO (d.get ("Type"));\r
-for (var e, $e = d.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) {\r
-var s = e.getKey ();\r
-if (s.equals ("Type") || s.startsWith ("!")) continue;\r
-sb.append ("/" + s);\r
-var o = e.getValue ();\r
-if (Clazz.instanceOf (o, java.util.Map)) {\r
-sb.append ((this.getDictionaryText (o, "")));\r
-continue;\r
-}s = e.getValue ();\r
-if (!s.startsWith ("/")) sb.append (" ");\r
-sb.appendO (s);\r
-}\r
-return (sb.length () > 3 ? sb.append (">>").append (nl).toString () : "");\r
-}, $fz.isPrivate = true, $fz), "java.util.Map,~S");\r
-Clazz.defineMethod (c$, "createSubdict", \r
-($fz = function (d0, dict) {\r
-var d = d0.get (dict);\r
-if (d == null) d0.put (dict, d =  new java.util.Hashtable ());\r
-return d;\r
-}, $fz.isPrivate = true, $fz), "java.util.Map,~S");\r
-Clazz.defineMethod (c$, "addResource", \r
-function (type, key, value) {\r
-var r = this.createSubdict (this.dictionary, "Resources");\r
-if (type != null) r = this.createSubdict (r, type);\r
-r.put (key, value);\r
-}, "~S,~S,~S");\r
-});\r
+Clazz.declarePackage ("javajs.export");
+Clazz.load (["javajs.util.SB"], "javajs.export.PDFObject", ["java.io.ByteArrayOutputStream", "java.util.Hashtable", "$.Map", "java.util.zip.Deflater", "$.DeflaterOutputStream"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.dictionary = null;
+this.stream = null;
+this.index = 0;
+this.type = null;
+this.len = 0;
+this.pt = 0;
+Clazz.instantialize (this, arguments);
+}, javajs["export"], "PDFObject", javajs.util.SB);
+Clazz.makeConstructor (c$, 
+function (index) {
+Clazz.superConstructor (this, javajs["export"].PDFObject, []);
+this.index = index;
+}, "~N");
+Clazz.defineMethod (c$, "getRef", 
+function () {
+return this.index + " 0 R";
+});
+Clazz.defineMethod (c$, "getID", 
+function () {
+return this.type.substring (0, 1) + this.index;
+});
+Clazz.defineMethod (c$, "isFont", 
+function () {
+return "Font".equals (this.type);
+});
+Clazz.defineMethod (c$, "setStream", 
+function (stream) {
+this.stream = stream;
+}, "~A");
+Clazz.defineMethod (c$, "getDef", 
+function (key) {
+return this.dictionary.get (key);
+}, "~S");
+Clazz.defineMethod (c$, "addDef", 
+function (key, value) {
+if (this.dictionary == null) this.dictionary =  new java.util.Hashtable ();
+this.dictionary.put (key, value);
+if (key.equals ("Type")) this.type = (value).substring (1);
+}, "~S,~O");
+Clazz.defineMethod (c$, "setAsStream", 
+function () {
+this.stream = this.toBytes (0, -1);
+this.setLength (0);
+});
+Clazz.defineMethod (c$, "output", 
+function (os) {
+if (this.index > 0) {
+var s = this.index + " 0 obj\n";
+this.write (os, s.getBytes (), 0);
+}var streamLen = 0;
+if (this.dictionary != null) {
+if (this.dictionary.containsKey ("Length")) {
+if (this.stream == null) this.setAsStream ();
+streamLen = this.stream.length;
+var doDeflate = (streamLen > 1000);
+if (doDeflate) {
+var deflater =  new java.util.zip.Deflater (9);
+var outBytes =  new java.io.ByteArrayOutputStream (1024);
+var compBytes =  new java.util.zip.DeflaterOutputStream (outBytes, deflater);
+compBytes.write (this.stream, 0, streamLen);
+compBytes.finish ();
+this.stream = outBytes.toByteArray ();
+this.dictionary.put ("Filter", "/FlateDecode");
+streamLen = this.stream.length;
+}this.dictionary.put ("Length", "" + streamLen);
+}this.write (os, this.getDictionaryText (this.dictionary, "\n").getBytes (), 0);
+}if (this.length () > 0) this.write (os, this.toString ().getBytes (), 0);
+if (this.stream != null) {
+this.write (os, "stream\r\n".getBytes (), 0);
+this.write (os, this.stream, streamLen);
+this.write (os, "\r\nendstream\r\n".getBytes (), 0);
+}if (this.index > 0) this.write (os, "endobj\n".getBytes (), 0);
+return this.len;
+}, "java.io.OutputStream");
+Clazz.defineMethod (c$, "write", 
+($fz = function (os, bytes, nBytes) {
+if (nBytes == 0) nBytes = bytes.length;
+this.len += nBytes;
+os.write (bytes, 0, nBytes);
+}, $fz.isPrivate = true, $fz), "java.io.OutputStream,~A,~N");
+Clazz.defineMethod (c$, "getDictionaryText", 
+($fz = function (d, nl) {
+var sb =  new javajs.util.SB ();
+sb.append ("<<");
+if (d.containsKey ("Type")) sb.append ("/Type").appendO (d.get ("Type"));
+for (var e, $e = d.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) {
+var s = e.getKey ();
+if (s.equals ("Type") || s.startsWith ("!")) continue;
+sb.append ("/" + s);
+var o = e.getValue ();
+if (Clazz.instanceOf (o, java.util.Map)) {
+sb.append ((this.getDictionaryText (o, "")));
+continue;
+}s = e.getValue ();
+if (!s.startsWith ("/")) sb.append (" ");
+sb.appendO (s);
+}
+return (sb.length () > 3 ? sb.append (">>").append (nl).toString () : "");
+}, $fz.isPrivate = true, $fz), "java.util.Map,~S");
+Clazz.defineMethod (c$, "createSubdict", 
+($fz = function (d0, dict) {
+var d = d0.get (dict);
+if (d == null) d0.put (dict, d =  new java.util.Hashtable ());
+return d;
+}, $fz.isPrivate = true, $fz), "java.util.Map,~S");
+Clazz.defineMethod (c$, "addResource", 
+function (type, key, value) {
+var r = this.createSubdict (this.dictionary, "Resources");
+if (type != null) r = this.createSubdict (r, type);
+r.put (key, value);
+}, "~S,~S,~S");
+});