/** * Returns the next {@link #R_PAREN} or {@link #COMMA} in the stream. * *@return the next R_PAREN or COMMA in the stream *@throws ParseException if the next token is not R_PAREN or COMMA *@throws IOException if an I/O error occurs * @param tokenizer tokenizer over a stream of text in Well-known Text */ private static String getNextCloserOrComma(StreamTokenizer tokenizer) throws IOException, ParseException { String nextWord = getNextWord(tokenizer); if (nextWord.equals(COMMA) || nextWord.equals(R_PAREN)) { return nextWord; } throw parseErrorExpected(tokenizer, COMMA + " or " + R_PAREN); }
/** * Returns the next word in the stream. * *@param tokenizer tokenizer over a stream of text in Well-known Text * format. The next token must be a word. *@return the next word in the stream as uppercase text *@throws ParseException if the next token is not a word *@throws IOException if an I/O error occurs */ private static String lookAheadWord(StreamTokenizer tokenizer) throws IOException, ParseException { String nextWord = getNextWord(tokenizer); tokenizer.pushBack(); return nextWord; }
/** * Returns the next EMPTY or L_PAREN in the stream as uppercase text. * *@return the next EMPTY or L_PAREN in the stream as uppercase * text. *@throws ParseException if the next token is not EMPTY or L_PAREN *@throws IOException if an I/O error occurs * @param tokenizer tokenizer over a stream of text in Well-known Text */ private static String getNextEmptyOrOpener(StreamTokenizer tokenizer) throws IOException, ParseException { String nextWord = getNextWord(tokenizer); if (nextWord.equalsIgnoreCase("Z")) { //z = true; nextWord = getNextWord(tokenizer); } else if (nextWord.equalsIgnoreCase("M")) { //m = true; nextWord = getNextWord(tokenizer); } else if (nextWord.equalsIgnoreCase("ZM")) { //z = true; //m = true; nextWord = getNextWord(tokenizer); } if (nextWord.equals(EMPTY) || nextWord.equals(L_PAREN)) { return nextWord; } throw parseErrorExpected(tokenizer, EMPTY + " or " + L_PAREN); }
/** * Returns the next {@link #R_PAREN} in the stream. * *@param tokenizer tokenizer over a stream of text in Well-known Text * format. The next token must be R_PAREN. *@return the next R_PAREN in the stream *@throws ParseException if the next token is not R_PAREN *@throws IOException if an I/O error occurs */ private String getNextCloser(StreamTokenizer tokenizer) throws IOException, ParseException { String nextWord = getNextWord(tokenizer); if (nextWord.equals(R_PAREN)) { return nextWord; } throw parseErrorExpected(tokenizer, R_PAREN); }
type = getNextWord(tokenizer).toUpperCase(); if (type.endsWith("ZM")) { ordinateFlags.add(Ordinate.Z);