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.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright 2006 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.render.afp.modca;
  18. import java.io.IOException;
  19. import java.io.OutputStream;
  20. import java.io.UnsupportedEncodingException;
  21. /**
  22. * The End Named Page Group (ENG) structured field terminates a page group that was
  23. * initiated by a Begin Named Page Group structured field.
  24. *
  25. * Note :This object will be used to represent an ENG
  26. * structured field. It is necessary as you can't end
  27. * a PageGroup because you don't know where the group
  28. * will end (as this is controlled by the tags in the FO).
  29. * <p>
  30. *
  31. */
  32. public class EndPageGroup extends AbstractNamedAFPObject {
  33. public EndPageGroup(String groupId) {
  34. super(groupId);
  35. log.debug("A ENG is being created for group: " + groupId);
  36. }
  37. /**
  38. * Accessor method to write the AFP datastream for the End Page Group.
  39. * @param os The stream to write to
  40. * @throws java.io.IOException
  41. */
  42. public void writeDataStream(OutputStream os)
  43. throws IOException {
  44. byte[] data = new byte[17];
  45. data[0] = 0x5A; // Structured field identifier
  46. data[1] = 0x00; // Length byte 1
  47. data[2] = 0x10; // Length byte 2
  48. data[3] = (byte) 0xD3; // Structured field id byte 1
  49. data[4] = (byte) 0xA9; // Structured field id byte 2
  50. data[5] = (byte) 0xAD; // Structured field id byte 3
  51. data[6] = 0x00; // Flags
  52. data[7] = 0x00; // Reserved
  53. data[8] = 0x00; // Reserved
  54. for (int i = 0; i < _nameBytes.length; i++) {
  55. data[9 + i] = _nameBytes[i];
  56. }
  57. os.write(data);
  58. }
  59. }