{
COSNumber cosCount = (COSNumber)tokens.get( i-1 );
for( int j=0; j<cosCount.intValue(); j++ )
{
i++;
COSString startRange = (COSString)tokens.get( i );
i++;
COSString endRange = (COSString)tokens.get( i );
CodespaceRange range = new CodespaceRange();
range.setStart( startRange.getBytes() );
range.setEnd( endRange.getBytes() );
result.addCodespaceRange( range );
}
}
else if( op.getOperation().equals( BEGIN_BASE_FONT_CHAR ) )
{
COSNumber cosCount = (COSNumber)tokens.get( i-1 );
for( int j=0; j<cosCount.intValue(); j++ )
{
i++;
COSString inputCode = (COSString)tokens.get( i );
i++;
Object nextToken = tokens.get( i );
if( nextToken instanceof COSString )
{
String value = new String( ((COSString)nextToken).getBytes(), "UTF-16BE" );
result.addMapping( inputCode.getBytes(), value );
}
else if( nextToken instanceof COSName )
{
result.addMapping( inputCode.getBytes(), ((COSName)nextToken).getName() );
}
else
{
throw new IOException( "Error parsing CMap beginbfchar, expected{COSString " +
"or COSName} and not " + nextToken );
}
}
}
else if( op.getOperation().equals( BEGIN_BASE_FONT_RANGE ) )
{
COSNumber cosCount = (COSNumber)tokens.get( i-1 );
for( int j=0; j<cosCount.intValue(); j++ )
{
i++;
COSString startCode = (COSString)tokens.get( i );
i++;
COSString endCode = (COSString)tokens.get( i );
i++;
Object nextToken = tokens.get( i );
byte[] startBytes = startCode.getBytes();
byte[] endBytes = endCode.getBytes();
byte[] tokenBytes = ((COSString)nextToken).getBytes();
String value = null;
while( !equals( startBytes, endBytes ) )