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.

EndSubRecord.java 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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.LittleEndianInput;
  17. import org.apache.poi.util.LittleEndianOutput;
  18. /**
  19. * ftEnd (0x0000)<p/>
  20. *
  21. * The end data record is used to denote the end of the subrecords.<p/>
  22. *
  23. * @author Glen Stampoultzis (glens at apache.org)
  24. */
  25. public final class EndSubRecord extends SubRecord {
  26. public final static short sid = 0x0000; // Note - zero sid is somewhat unusual (compared to plain Records)
  27. private static final int ENCODED_SIZE = 0;
  28. public EndSubRecord()
  29. {
  30. }
  31. /**
  32. * @param in unused (since this record has no data)
  33. * @param size
  34. */
  35. public EndSubRecord(LittleEndianInput in, int size) {
  36. if ((size & 0xFF) != ENCODED_SIZE) { // mask out random crap in upper byte
  37. throw new RecordFormatException("Unexpected size (" + size + ")");
  38. }
  39. }
  40. @Override
  41. public boolean isTerminating(){
  42. return true;
  43. }
  44. public String toString()
  45. {
  46. StringBuffer buffer = new StringBuffer();
  47. buffer.append("[ftEnd]\n");
  48. buffer.append("[/ftEnd]\n");
  49. return buffer.toString();
  50. }
  51. public void serialize(LittleEndianOutput out) {
  52. out.writeShort(sid);
  53. out.writeShort(ENCODED_SIZE);
  54. }
  55. protected int getDataSize() {
  56. return ENCODED_SIZE;
  57. }
  58. public short getSid()
  59. {
  60. return sid;
  61. }
  62. public Object clone() {
  63. EndSubRecord rec = new EndSubRecord();
  64. return rec;
  65. }
  66. }