You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PDFFileSpec.java 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Copyright 1999-2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /* $Id$ */
  17. package org.apache.fop.pdf;
  18. /**
  19. * class representing a /FileSpec object.
  20. *
  21. */
  22. public class PDFFileSpec extends PDFObject {
  23. /**
  24. * the filename
  25. */
  26. protected String filename;
  27. /**
  28. * create a /FileSpec object.
  29. *
  30. * @param filename the filename represented by this object
  31. */
  32. public PDFFileSpec(String filename) {
  33. /* generic creation of object */
  34. super();
  35. this.filename = filename;
  36. }
  37. /**
  38. * @see org.apache.fop.pdf.PDFObject#toPDFString()
  39. */
  40. public String toPDFString() {
  41. return getObjectID()
  42. + "<<\n/Type /FileSpec\n"
  43. + "/F (" + this.filename + ")\n"
  44. + ">>\nendobj\n";
  45. }
  46. /*
  47. * example
  48. * 29 0 obj
  49. * <<
  50. * /Type /FileSpec
  51. * /F (table1.pdf)
  52. * >>
  53. * endobj
  54. */
  55. /**
  56. * Check if this equals another object.
  57. *
  58. * @param obj the object to compare
  59. * @return true if this equals other object
  60. */
  61. public boolean equals(Object obj) {
  62. if (this == obj) {
  63. return true;
  64. }
  65. if (obj == null || !(obj instanceof PDFFileSpec)) {
  66. return false;
  67. }
  68. PDFFileSpec spec = (PDFFileSpec)obj;
  69. if (!spec.filename.equals(filename)) {
  70. return false;
  71. }
  72. return true;
  73. }
  74. }