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.Peek
The unique instance.private static final String
The expected keyword after spaces removal. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ProbeResult
forKeyword
(char[] keyword, int length) Returns the value to be returned byStoreProvider.probeContent(StorageConnector)
for the given WKT keyword.protected int
isKeywordChar
(int c) Returns whether the given character is valid for the keyword.protected boolean
isPostKeyword
(int c) Returnstrue
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
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:
isKeywordChar
in classFirstKeywordPeek
- 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, orFirstKeywordPeek.IGNORE
if the character should be accepted but not stored.
-
isPostKeyword
protected boolean isPostKeyword(int c) Returnstrue
if the given first non-white character after the keyword is one of the expected characters.- Specified by:
isPostKeyword
in classFirstKeywordPeek
- 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
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:
forKeyword
in classFirstKeywordPeek
- Parameters:
keyword
- the first keyword found in the input. May benull
iflength
is zero.length
- number of valid characters inkeyword
.- Returns:
ProbeResult.SUPPORTED
if the given storage seems to be readable.
-