return i;
}
private int readIndexedColorspace(PdfObject pdfObject, int i, byte[] raw) {
//read the base value
PdfObject IndexedColorSpace=new ColorSpaceObject(-1,0,true);
//IndexedColorSpace.setRef(pdfObject.getObjectRefAsString());
i=handleColorSpaces(IndexedColorSpace, i, raw);
pdfObject.setDictionary(PdfDictionary.Indexed,IndexedColorSpace);
//onto hival number
while(i<raw.length && (raw[i]==32 || raw[i]==13 || raw[i]==10 || raw[i]==']' || raw[i]=='>'))
i++;
if(debugColorspace)
System.out.println(padding + "Indexed Reading hival starting at >>" + (char) raw[i] + (char) raw[i + 1]+(char)+raw[i+2]+"<<i="+i);
//hival
i = setNumberValue(pdfObject, i, raw, PdfDictionary.hival);
if(debugColorspace)
System.out.println("hival="+pdfObject.getInt(PdfDictionary.hival)+" i="+i+" raw[i]="+(char)raw[i]);
if(raw[i]!='(')
i++;
if(debugColorspace)
System.out.println(padding + "next chars >>" + (char) raw[i] + (char) raw[i + 1]+(char)+raw[i+2]+"<<i="+i);
//onto lookup
while(i<raw.length && (raw[i]==32 || raw[i]==13 || raw[i]==10))
i++;
if(debugColorspace)
System.out.println(padding+"Indexed Reading lookup "+(char)raw[i]+(char)raw[i+1]+(char)raw[i+2]+(char)raw[i+3]+(char)raw[i+4]);
//read lookup
//get the colorspace data (base)
PdfObject IndexedColorSpaceData;
//can be embedded in this object (when we need to use ref or in separate object
//when we need to use that ref). This code switches as needed)
boolean needsKey=raw[i]=='[' || raw[i]=='(' || raw[i]=='<';
if(needsKey)
IndexedColorSpaceData=new ColorSpaceObject(pdfObject.getObjectRefAsString());
else
IndexedColorSpaceData=new ColorSpaceObject(-1,0);
//IndexedColorSpace.setRef(pdfObject.getObjectRefAsString());
pdfObject.setDictionary(PdfDictionary.Lookup,IndexedColorSpaceData);
i=handleColorSpaces(IndexedColorSpaceData, i, raw);