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.

BytePropertyNode.java 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. /**
  17. * Normally PropertyNodes only ever work in characters, but
  18. * a few cases actually store bytes, and this lets everything
  19. * still work despite that.
  20. * It handles the conversion as required between bytes
  21. * and characters.
  22. *
  23. * @deprecated byte positions shall not be saved in memory
  24. */
  25. @Deprecated
  26. public abstract class BytePropertyNode<T extends BytePropertyNode<T>> extends PropertyNode<T> {
  27. private final int startBytes;
  28. private final int endBytes;
  29. protected BytePropertyNode( BytePropertyNode other ) {
  30. super(other);
  31. startBytes = other.startBytes;
  32. endBytes = other.endBytes;
  33. }
  34. protected BytePropertyNode( int charStart, int charEnd, Object buf ) {
  35. super( charStart, charEnd, buf );
  36. if ( charStart > charEnd )
  37. throw new IllegalArgumentException( "charStart (" + charStart
  38. + ") > charEnd (" + charEnd + ")" );
  39. this.startBytes = -1;
  40. this.endBytes = -1;
  41. }
  42. /**
  43. * @deprecated Though bytes are actually stored in file, it is advised to
  44. * use char positions for all operations. Including save
  45. * operations, because only char positions are preserved.
  46. */
  47. @Deprecated
  48. public int getStartBytes()
  49. {
  50. return startBytes;
  51. }
  52. /**
  53. * @deprecated Though bytes are actually stored in file, it is advised to
  54. * use char positions for all operations. Including save
  55. * operations, because only char positions are preserved.
  56. */
  57. @Deprecated
  58. public int getEndBytes()
  59. {
  60. return endBytes;
  61. }
  62. }