public IdRange [ ] parseIdRange ( ImapRequestLineReader request ) throws ProtocolException { CharacterValidator validator = new MessageSetCharValidator ( ) ; String nextWord = consumeWord ( request , validator ) ; int commaPos = nextWord . indexOf ( ' ' ) ; if ( commaPos == - 1 ) { return new IdRange [ ] { IdRange . parseRange ( nextWord ) } ; } List < IdRange > rangeList = new ArrayList <> ( ) ; int pos = 0 ; while ( commaPos != - 1 ) { String range = nextWord . substring ( pos , commaPos ) ; IdRange set = IdRange . parseRange ( range ) ; rangeList . add ( set ) ; pos = commaPos + 1 ; commaPos = nextWord . indexOf ( ' ' , pos ) ; } String range = nextWord . substring ( pos ) ; rangeList . add ( IdRange . parseRange ( range ) ) ; return rangeList . toArray ( new IdRange [ rangeList . size ( ) ] ) ; }
Reads a message set argument and parses into an IdSet . Currently only supports a single range of values .