Class PRJDataStore.AuxiliaryContent

java.lang.Object
org.apache.sis.internal.storage.PRJDataStore.AuxiliaryContent
All Implemented Interfaces:
CharSequence
Enclosing class:
PRJDataStore

protected static final class PRJDataStore.AuxiliaryContent extends Object implements CharSequence
Content of a file read by PRJDataStore.readAuxiliaryFile(String). This is used as a workaround for not being able to return multiple values from a single method. Instances of this class should be short lived, because they hold larger arrays than necessary.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final char[]
    The textual content of the auxiliary file.
    private final int
    Number of valid characters in buffer.
    private final int
    Index of the first valid character in buffer.
    private final Object
    Path or URL that have been read.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    AuxiliaryContent(Object source, char[] buffer, int offset, int length)
    Wraps (without copying) the given array as the content of an auxiliary file.
  • Method Summary

    Modifier and Type
    Method
    Description
    char
    charAt(int index)
    Returns the character at the given index.
    Returns the filename (without path) of the auxiliary file.
    int
    Returns the number of valid characters in this sequence.
    subSequence(int start, int end)
    Returns a sub-sequence of this auxiliary file content.
    Copies this auxiliary file content in a String.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.lang.CharSequence

    chars, codePoints, isEmpty
  • Field Details

    • source

      private final Object source
      Path or URL that have been read.
    • buffer

      private final char[] buffer
      The textual content of the auxiliary file.
    • offset

      private final int offset
      Index of the first valid character in buffer.
    • length

      private final int length
      Number of valid characters in buffer.
  • Constructor Details

    • AuxiliaryContent

      private AuxiliaryContent(Object source, char[] buffer, int offset, int length)
      Wraps (without copying) the given array as the content of an auxiliary file.
  • Method Details

    • getFilename

      public String getFilename()
      Returns the filename (without path) of the auxiliary file. This information is mainly for producing error messages.
      Returns:
      name of the auxiliary file that have been read.
    • length

      public int length()
      Returns the number of valid characters in this sequence.
      Specified by:
      length in interface CharSequence
    • charAt

      public char charAt(int index)
      Returns the character at the given index. For performance reasons this method does not check index bounds. The behavior of this method is undefined if the given index is not smaller than length(). We skip bounds check because this class should be used for Apache SIS internal purposes only.
      Specified by:
      charAt in interface CharSequence
    • subSequence

      public CharSequence subSequence(int start, int end)
      Returns a sub-sequence of this auxiliary file content. For performance reasons this method does not perform bound checks. The behavior of this method is undefined if arguments are out of bounds. We skip bounds check because this class should be used for Apache SIS internal purposes only.
      Specified by:
      subSequence in interface CharSequence
    • toString

      public String toString()
      Copies this auxiliary file content in a String. This method does not cache the result; caller should invoke at most once.
      Specified by:
      toString in interface CharSequence
      Overrides:
      toString in class Object