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.

CompressedObjectReference.java 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id$ */
  18. package org.apache.fop.pdf.xref;
  19. import java.io.DataOutputStream;
  20. import java.io.IOException;
  21. /**
  22. * A reference to an indirect object stored in an object stream. Contains the relevant
  23. * information to add to a cross-reference stream.
  24. */
  25. public class CompressedObjectReference implements ObjectReference {
  26. private final int objectNumber;
  27. private final int objectStreamNumber;
  28. private final int index;
  29. /**
  30. * Creates a new reference.
  31. *
  32. * @param objectNumber the number of the compressed object being referenced
  33. * @param objectStreamNumber the number of the object stream in which the compressed
  34. * object is to be found
  35. * @param index the index of the compressed object in the object stream
  36. */
  37. public CompressedObjectReference(int objectNumber, int objectStreamNumber, int index) {
  38. this.objectNumber = objectNumber;
  39. this.objectStreamNumber = objectStreamNumber;
  40. this.index = index;
  41. }
  42. public void output(DataOutputStream out) throws IOException {
  43. out.write(2);
  44. out.writeLong(objectStreamNumber);
  45. out.write(0);
  46. out.write(index);
  47. }
  48. public int getObjectNumber() {
  49. return objectNumber;
  50. }
  51. public int getObjectStreamNumber() {
  52. return objectStreamNumber;
  53. }
  54. }