您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

FtrHeader.java 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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.hssf.record.common;
  16. import org.apache.poi.hssf.record.RecordInputStream;
  17. import org.apache.poi.util.LittleEndianOutput;
  18. /**
  19. * Title: FtrHeader (Future Record Header) common record part
  20. * <P>
  21. * This record part specifies a header for a Ftr (Future)
  22. * style record, which includes extra attributes above and
  23. * beyond those of a traditional record.
  24. */
  25. public final class FtrHeader {
  26. /** This MUST match the type on the containing record */
  27. private short recordType;
  28. /** This is a FrtFlags */
  29. private short grbitFrt;
  30. /** MUST be 8 bytes and all zero */
  31. private byte[] reserved;
  32. public FtrHeader() {
  33. reserved = new byte[8];
  34. }
  35. public FtrHeader(RecordInputStream in) {
  36. recordType = in.readShort();
  37. grbitFrt = in.readShort();
  38. reserved = new byte[8];
  39. in.read(reserved, 0, 8);
  40. }
  41. public String toString() {
  42. StringBuffer buffer = new StringBuffer();
  43. buffer.append(" [FUTURE HEADER]\n");
  44. buffer.append(" Type " + recordType);
  45. buffer.append(" Flags " + grbitFrt);
  46. buffer.append(" [/FUTURE HEADER]\n");
  47. return buffer.toString();
  48. }
  49. public void serialize(LittleEndianOutput out) {
  50. out.writeShort(recordType);
  51. out.writeShort(grbitFrt);
  52. out.write(reserved);
  53. }
  54. public static int getDataSize() {
  55. return 12;
  56. }
  57. public short getRecordType() {
  58. return recordType;
  59. }
  60. public void setRecordType(short recordType) {
  61. this.recordType = recordType;
  62. }
  63. public short getGrbitFrt() {
  64. return grbitFrt;
  65. }
  66. public void setGrbitFrt(short grbitFrt) {
  67. this.grbitFrt = grbitFrt;
  68. }
  69. public byte[] getReserved() {
  70. return reserved;
  71. }
  72. public void setReserved(byte[] reserved) {
  73. this.reserved = reserved;
  74. }
  75. }