Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

CharIndexTranslator.java 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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.util.Internal;
  17. @Internal
  18. public interface CharIndexTranslator {
  19. /**
  20. * Calculates the byte index of the given char index.
  21. *
  22. * @param charPos
  23. * The char position
  24. * @return The byte index
  25. */
  26. int getByteIndex( int charPos );
  27. /**
  28. * Finds character ranges that includes specified byte range.
  29. *
  30. * @param startBytePosInclusive
  31. * start byte range
  32. * @param endBytePosExclusive
  33. * end byte range
  34. */
  35. int[][] getCharIndexRanges( int startBytePosInclusive,
  36. int endBytePosExclusive );
  37. /**
  38. * Check if index is in table
  39. *
  40. * @return true if index in table, false if not
  41. */
  42. boolean isIndexInTable(int bytePos);
  43. /**
  44. * Return first index >= bytePos that is in table
  45. *
  46. * @return first index greater or equal to bytePos that is in table
  47. */
  48. int lookIndexForward(int bytePos);
  49. /**
  50. * Return last index <= bytePos that is in table
  51. *
  52. * @return last index less of equal to bytePos that is in table
  53. */
  54. int lookIndexBackward(int bytePos);
  55. }