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.

FieldDescriptor.java 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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.hwpf.model;
  16. import org.apache.poi.hwpf.model.types.FLDAbstractType;
  17. import org.apache.poi.util.Internal;
  18. /**
  19. * Class for the FLD structure.
  20. */
  21. @Internal
  22. public final class FieldDescriptor extends FLDAbstractType
  23. {
  24. public static final int FIELD_BEGIN_MARK = 0x13;
  25. public static final int FIELD_SEPARATOR_MARK = 0x14;
  26. public static final int FIELD_END_MARK = 0x15;
  27. public FieldDescriptor( byte[] data )
  28. {
  29. fillFields( data, 0 );
  30. }
  31. public int getBoundaryType()
  32. {
  33. return getCh();
  34. }
  35. public int getFieldType()
  36. {
  37. if ( getCh() != FIELD_BEGIN_MARK )
  38. throw new UnsupportedOperationException(
  39. "This field is only defined for begin marks." );
  40. return getFlt();
  41. }
  42. public boolean isZombieEmbed()
  43. {
  44. if ( getCh() != FIELD_END_MARK )
  45. throw new UnsupportedOperationException(
  46. "This field is only defined for end marks." );
  47. return isFZombieEmbed();
  48. }
  49. public boolean isResultDirty()
  50. {
  51. if ( getCh() != FIELD_END_MARK )
  52. throw new UnsupportedOperationException(
  53. "This field is only defined for end marks." );
  54. return isFResultDirty();
  55. }
  56. public boolean isResultEdited()
  57. {
  58. if ( getCh() != FIELD_END_MARK )
  59. throw new UnsupportedOperationException(
  60. "This field is only defined for end marks." );
  61. return isFResultEdited();
  62. }
  63. public boolean isLocked()
  64. {
  65. if ( getCh() != FIELD_END_MARK )
  66. throw new UnsupportedOperationException(
  67. "This field is only defined for end marks." );
  68. return isFLocked();
  69. }
  70. public boolean isPrivateResult()
  71. {
  72. if ( getCh() != FIELD_END_MARK )
  73. throw new UnsupportedOperationException(
  74. "This field is only defined for end marks." );
  75. return isFPrivateResult();
  76. }
  77. public boolean isNested()
  78. {
  79. if ( getCh() != FIELD_END_MARK )
  80. throw new UnsupportedOperationException(
  81. "This field is only defined for end marks." );
  82. return isFNested();
  83. }
  84. public boolean isHasSep()
  85. {
  86. if ( getCh() != FIELD_END_MARK )
  87. throw new UnsupportedOperationException(
  88. "This field is only defined for end marks." );
  89. return isFHasSep();
  90. }
  91. }