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.

InterfaceHdrRecord.java 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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;
  16. import org.apache.poi.util.LittleEndianOutput;
  17. /**
  18. * Title: Interface Header Record<P>
  19. * Description: Defines the beginning of Interface records (MMS)<P>
  20. * REFERENCE: PG 324 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
  21. * @author Andrew C. Oliver (acoliver at apache dot org)
  22. * @version 2.0-pre
  23. */
  24. public final class InterfaceHdrRecord
  25. extends StandardRecord
  26. {
  27. public final static short sid = 0xe1;
  28. private short field_1_codepage; // = 0;
  29. /**
  30. * suggested (and probably correct) default
  31. */
  32. public final static short CODEPAGE = ( short ) 0x4b0;
  33. public InterfaceHdrRecord()
  34. {
  35. }
  36. public InterfaceHdrRecord(RecordInputStream in)
  37. {
  38. field_1_codepage = in.readShort();
  39. }
  40. /**
  41. * set the codepage for the file
  42. *
  43. * @param cp - the codepage
  44. * @see #CODEPAGE
  45. */
  46. public void setCodepage(short cp)
  47. {
  48. field_1_codepage = cp;
  49. }
  50. /**
  51. * get the codepage for the file
  52. *
  53. * @return the codepage
  54. * @see #CODEPAGE
  55. */
  56. public short getCodepage()
  57. {
  58. return field_1_codepage;
  59. }
  60. public String toString()
  61. {
  62. StringBuffer buffer = new StringBuffer();
  63. buffer.append("[INTERFACEHDR]\n");
  64. buffer.append(" .codepage = ")
  65. .append(Integer.toHexString(getCodepage())).append("\n");
  66. buffer.append("[/INTERFACEHDR]\n");
  67. return buffer.toString();
  68. }
  69. public void serialize(LittleEndianOutput out) {
  70. out.writeShort(getCodepage());
  71. }
  72. protected int getDataSize() {
  73. return 2;
  74. }
  75. public short getSid()
  76. {
  77. return sid;
  78. }
  79. }