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.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. * DrawingRecord (0x00EC)<p/>
  19. */
  20. public final class DrawingRecord extends StandardRecord {
  21. public static final short sid = 0x00EC;
  22. private static final byte[] EMPTY_BYTE_ARRAY = {};
  23. private byte[] recordData;
  24. private byte[] contd;
  25. public DrawingRecord() {
  26. recordData = EMPTY_BYTE_ARRAY;
  27. }
  28. public DrawingRecord(RecordInputStream in) {
  29. recordData = in.readRemainder();
  30. }
  31. public void processContinueRecord(byte[] record) {
  32. //don't merge continue record with the drawing record, it must be serialized separately
  33. contd = record;
  34. }
  35. public void serialize(LittleEndianOutput out) {
  36. out.write(recordData);
  37. }
  38. protected int getDataSize() {
  39. return recordData.length;
  40. }
  41. public short getSid() {
  42. return sid;
  43. }
  44. public byte[] getData() {
  45. // if (continueData.size() != 0) {
  46. // byte[] newBuffer = new byte[recordData.length + continueData.size()];
  47. // System.arraycopy(recordData, 0, newBuffer, 0, recordData.length);
  48. // System.arraycopy(continueData.toByteArray(), 0, newBuffer, recordData.length, continueData.size());
  49. // return newBuffer;
  50. // }
  51. return recordData;
  52. }
  53. public byte[] getRecordData(){
  54. return recordData;
  55. }
  56. public void setData(byte[] thedata) {
  57. if (thedata == null) {
  58. throw new IllegalArgumentException("data must not be null");
  59. }
  60. recordData = thedata;
  61. }
  62. public Object clone() {
  63. DrawingRecord rec = new DrawingRecord();
  64. rec.recordData = recordData.clone();
  65. if (contd != null) {
  66. // TODO - this code probably never executes
  67. rec.contd = contd.clone();
  68. }
  69. return rec;
  70. }
  71. }