{
retval = MARK_END_OF_DICTIONARY;
}
else
{
throw new IOException( "Error: expected the end of a dictionary.");
}
break;
}
case ']':
{
retval = MARK_END_OF_ARRAY;
break;
}
case '[':
{
List list = new ArrayList();
Object nextToken = parseNextToken( is );
while( nextToken != MARK_END_OF_ARRAY )
{
list.add( nextToken );
nextToken = parseNextToken( is );
}
retval = list;
break;
}
case '<':
{
int theNextByte = is.read();
if( theNextByte == '<' )
{
Map result = new HashMap();
//we are reading a dictionary
Object key = parseNextToken( is );
while( key instanceof LiteralName && key != MARK_END_OF_DICTIONARY )
{
Object value = parseNextToken( is );
result.put( ((LiteralName)key).name, value );
key = parseNextToken( is );
}
retval = result;
}
else
{
//won't read more than 512 bytes
int multiplyer = 16;
int bufferIndex = -1;
while( theNextByte != -1 && theNextByte != '>' )
{
int intValue = 0;
if( theNextByte >= '0' && theNextByte <= '9' )
{
intValue = theNextByte - '0';
}
else if( theNextByte >= 'A' && theNextByte <= 'F' )
{
intValue = 10 + theNextByte - 'A';
}
else if( theNextByte >= 'a' && theNextByte <= 'f' )
{
intValue = 10 + theNextByte - 'a';
}
else
{
throw new IOException( "Error: expected hex character and not " +
(char)theNextByte + ":" + theNextByte );
}
intValue *= multiplyer;
if( multiplyer == 16 )
{