Class StoreProvider.Peek
java.lang.Object
org.apache.sis.internal.storage.wkt.FirstKeywordPeek
org.apache.sis.internal.storage.csv.StoreProvider.Peek
- Enclosing class:
- StoreProvider
The object to use for verifying if the first keyword is the expected one.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final StoreProvider.PeekThe unique instance.private static final StringThe expected keyword after spaces removal. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ProbeResultforKeyword(char[] keyword, int length) Returns the value to be returned byStoreProvider.probeContent(StorageConnector)for the given WKT keyword.protected intisKeywordChar(int c) Returns whether the given character is valid for the keyword.protected booleanisPostKeyword(int c) Returnstrueif 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
getAuxiliaryPath, probeContent, probeContent
-
Field Details
-
INSTANCE
The unique instance. -
KEYWORD
The expected keyword after spaces removal.- See Also:
-
-
Constructor Details
-
Peek
private Peek()Creates a new instance.
-
-
Method Details
-
isKeywordChar
protected int isKeywordChar(int c) Returns whether the given character is valid for the keyword. This implementation accepts'@'in addition of the alphanumeric characters accepted by the parent class.- Overrides:
isKeywordCharin classFirstKeywordPeek- Parameters:
c- the character to test.- Returns:
FirstKeywordPeek.ACCEPTif the given character should be accepted,FirstKeywordPeek.REJECTif the character is not valid for the keyword, orFirstKeywordPeek.IGNOREif the character should be accepted but not stored.
-
isPostKeyword
protected boolean isPostKeyword(int c) Returnstrueif the given first non-white character after the keyword is one of the expected characters.- Specified by:
isPostKeywordin classFirstKeywordPeek- Parameters:
c- the first non-white character after the keyword, or -1 if we reached the end of stream.- Returns:
trueif the given character is one of the expected post-keyword characters.
-
forKeyword
Returns the value to be returned byStoreProvider.probeContent(StorageConnector)for the given WKT keyword. This method changes the case to match the one used in the keywords map, then verify if the keyword that we found is one of the known WKT keywords. Keywords with the "CRS" suffix are WKT 2 while keywords with the "CS" suffix are WKT 1.- Specified by:
forKeywordin classFirstKeywordPeek- Parameters:
keyword- the first keyword found in the input. May benulliflengthis zero.length- number of valid characters inkeyword.- Returns:
ProbeResult.SUPPORTEDif the given storage seems to be readable.
-