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.

DocInfoListContainer.java 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==================================================================== */
  15. package org.apache.poi.hslf.record;
  16. import java.io.IOException;
  17. import java.io.OutputStream;
  18. import java.util.Map;
  19. import java.util.function.Supplier;
  20. import org.apache.poi.util.LittleEndian;
  21. /**
  22. * A container record that specifies information about the document and document display settings.
  23. */
  24. public final class DocInfoListContainer extends RecordContainer {
  25. private byte[] _header;
  26. private static final long _type = RecordTypes.List.typeID;
  27. // Links to our more interesting children
  28. /**
  29. * Set things up, and find our more interesting children
  30. */
  31. protected DocInfoListContainer(byte[] source, int start, int len) {
  32. // Grab the header
  33. _header = new byte[8];
  34. System.arraycopy(source,start,_header,0,8);
  35. // Find our children
  36. _children = Record.findChildRecords(source,start+8,len-8);
  37. findInterestingChildren();
  38. }
  39. /**
  40. * Go through our child records, picking out the ones that are
  41. * interesting, and saving those for use by the easy helper
  42. * methods.
  43. */
  44. private void findInterestingChildren() {
  45. }
  46. /**
  47. * Create a new DocInfoListContainer, with blank fields - not yet supported
  48. */
  49. private DocInfoListContainer() {
  50. _header = new byte[8];
  51. _children = new org.apache.poi.hslf.record.Record[0];
  52. // Setup our header block
  53. _header[0] = 0x0f; // We are a container record
  54. LittleEndian.putShort(_header, 2, (short)_type);
  55. // Setup our child records
  56. findInterestingChildren();
  57. }
  58. /**
  59. * We are of type 0x7D0
  60. */
  61. public long getRecordType() { return _type; }
  62. /**
  63. * Write the contents of the record back, so it can be written
  64. * to disk
  65. */
  66. public void writeOut(OutputStream out) throws IOException {
  67. writeOut(_header[0],_header[1],_type,_children,out);
  68. }
  69. @Override
  70. public Map<String, Supplier<?>> getGenericProperties() {
  71. return null;
  72. }
  73. }