Class LandsatStoreProvider.Peek

java.lang.Object
org.apache.sis.internal.storage.wkt.FirstKeywordPeek
org.apache.sis.storage.landsat.LandsatStoreProvider.Peek
Enclosing class:
LandsatStoreProvider

private static final class LandsatStoreProvider.Peek extends FirstKeywordPeek
The object to use for verifying if the first keyword is the expected one.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final int
    The part in process of being parsed: KEY (0) for the "GROUP" keyword, SEPARATOR (1) for the '=' symbol, VALUE (2) for the "L1_METADATA_FILE" value.
    private static final String
    The expected keyword after spaces removal.
    private static final String
    The expected keyword after spaces removal.
    private int
    1 if parsing the characters after the = symbol, 2 if parsing the non-white characters after =.
    private static final int
    The part in process of being parsed: KEY (0) for the "GROUP" keyword, SEPARATOR (1) for the '=' symbol, VALUE (2) for the "L1_METADATA_FILE" value.
    private static final int
    The part in process of being parsed: KEY (0) for the "GROUP" keyword, SEPARATOR (1) for the '=' symbol, VALUE (2) for the "L1_METADATA_FILE" value.

    Fields inherited from class org.apache.sis.internal.storage.wkt.FirstKeywordPeek

    ACCEPT, COMMENT, IGNORE, maxLength, REJECT
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected ProbeResult
    forKeyword(char[] keyword, int length)
    Returns the value to be returned by LandsatStoreProvider.probeContent(StorageConnector) for the given keyword.
    protected Path
    Returns the path to the metadata file relative to the directory specified by user.
    protected int
    Returns ACCEPT if the given character is valid for a keyword.
    protected boolean
    Returns true if the given first non-white character after the keyword is one of the expected characters.

    Methods inherited from class org.apache.sis.internal.storage.wkt.FirstKeywordPeek

    probeContent, probeContent

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • KEYWORD

      private static final String KEYWORD
      The expected keyword after spaces removal.
      See Also:
    • L1_KEYWORD

      private static final String L1_KEYWORD
      The expected keyword after spaces removal.
      See Also:
    • KEY

      private static final int KEY
      The part in process of being parsed:
      • KEY (0) for the "GROUP" keyword,
      • SEPARATOR (1) for the '=' symbol,
      • VALUE (2) for the "L1_METADATA_FILE" value.
      See Also:
    • SEPARATOR

      private static final int SEPARATOR
      The part in process of being parsed:
      • KEY (0) for the "GROUP" keyword,
      • SEPARATOR (1) for the '=' symbol,
      • VALUE (2) for the "L1_METADATA_FILE" value.
      See Also:
    • VALUE

      private static final int VALUE
      The part in process of being parsed:
      • KEY (0) for the "GROUP" keyword,
      • SEPARATOR (1) for the '=' symbol,
      • VALUE (2) for the "L1_METADATA_FILE" value.
      See Also:
    • part

      private int part
      1 if parsing the characters after the = symbol, 2 if parsing the non-white characters after =.
  • Constructor Details

    • Peek

      Peek()
      Creates a new instance.
  • Method Details

    • getAuxiliaryPath

      protected Path getAuxiliaryPath(StorageConnector connector) throws DataStoreException
      Returns the path to the metadata file relative to the directory specified by user. This method is invoked if the user gave us the directory containing all Landsat files instead of the path to the metadata file.
      Overrides:
      getAuxiliaryPath in class FirstKeywordPeek
      Parameters:
      connector - the connector from which to derive the path to auxiliary file to test.
      Returns:
      path to the auxiliary file to test, or null if it does not exist.
      Throws:
      DataStoreException - if an error occurred while determining the auxiliary file.
    • isKeywordChar

      protected int isKeywordChar(int c)
      Returns ACCEPT if the given character is valid for a keyword.
      Overrides:
      isKeywordChar in class FirstKeywordPeek
      Parameters:
      c - the character to test.
      Returns:
      FirstKeywordPeek.ACCEPT if the given character should be accepted, FirstKeywordPeek.REJECT if the character is not valid for the keyword, or FirstKeywordPeek.IGNORE if the character should be accepted but not stored.
    • isPostKeyword

      protected boolean isPostKeyword(int c)
      Returns true if the given first non-white character after the keyword is one of the expected characters. This implementation expects the first letter of the "GROUP" keyword for the first sub-group (unless there is a comment line between them).
      Specified by:
      isPostKeyword in class FirstKeywordPeek
      Parameters:
      c - the first non-white character after the keyword, or -1 if we reached the end of stream.
      Returns:
      true if the given character is one of the expected post-keyword characters.
    • forKeyword

      protected ProbeResult forKeyword(char[] keyword, int length)
      Returns the value to be returned by LandsatStoreProvider.probeContent(StorageConnector) for the given keyword.
      Specified by:
      forKeyword in class FirstKeywordPeek
      Parameters:
      keyword - the first keyword found in the input. May be null if length is zero.
      length - number of valid characters in keyword.
      Returns:
      ProbeResult.SUPPORTED if the given storage seems to be readable.