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.

FeatSmartTag.java 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 java.util.Map;
  17. import java.util.function.Supplier;
  18. import org.apache.poi.hssf.record.FeatRecord;
  19. import org.apache.poi.hssf.record.RecordInputStream;
  20. import org.apache.poi.util.GenericRecordJsonWriter;
  21. import org.apache.poi.util.GenericRecordUtil;
  22. import org.apache.poi.util.LittleEndianOutput;
  23. //import org.apache.poi.hssf.record.Feat11Record;
  24. //import org.apache.poi.hssf.record.Feat12Record;
  25. /**
  26. * Title: FeatSmartTag (Smart Tag Shared Feature) common record part
  27. * <P>
  28. * This record part specifies Smart Tag data for a sheet, stored as part
  29. * of a Shared Feature. It can be found in records such as {@link FeatRecord}.
  30. * It is made up of a hash, and a set of Factoid Data that makes up
  31. * the smart tags.
  32. * For more details, see page 669 of the Excel binary file
  33. * format documentation.
  34. */
  35. public final class FeatSmartTag implements SharedFeature {
  36. // TODO - process
  37. private byte[] data;
  38. public FeatSmartTag() {
  39. data = new byte[0];
  40. }
  41. public FeatSmartTag(FeatSmartTag other) {
  42. data = (other.data == null) ? null : other.data.clone();
  43. }
  44. public FeatSmartTag(RecordInputStream in) {
  45. data = in.readRemainder();
  46. }
  47. public String toString() {
  48. return GenericRecordJsonWriter.marshal(this);
  49. }
  50. public int getDataSize() {
  51. return data.length;
  52. }
  53. public void serialize(LittleEndianOutput out) {
  54. out.write(data);
  55. }
  56. @Override
  57. public FeatSmartTag copy() {
  58. return new FeatSmartTag(this);
  59. }
  60. @Override
  61. public Map<String, Supplier<?>> getGenericProperties() {
  62. return GenericRecordUtil.getGenericProperties("data", () -> data);
  63. }
  64. }