protected internal PdfObject ReadSingleObject(int k) {
strings.Clear();
int k2 = k * 2;
int pos = xref[k2];
if (pos < 0)
return null;
if (xref[k2 + 1] > 0)
pos = objStmToOffset[xref[k2 + 1]];
if (pos == 0)
return null;
tokens.Seek(pos);
tokens.NextValidToken();
if (tokens.TokenType != PRTokeniser.TK_NUMBER)
tokens.ThrowError("Invalid object number.");
objNum = tokens.IntValue;
tokens.NextValidToken();
if (tokens.TokenType != PRTokeniser.TK_NUMBER)
tokens.ThrowError("Invalid generation number.");
objGen = tokens.IntValue;
tokens.NextValidToken();
if (!tokens.StringValue.Equals("obj"))
tokens.ThrowError("Token 'obj' expected.");
PdfObject obj;
try {
obj = ReadPRObject();
for (int j = 0; j < strings.Count; ++j) {
PdfString str = (PdfString)strings[j];
str.Decrypt(this);
}
if (obj.IsStream()) {
CheckPRStreamLength((PRStream)obj);
}
}
catch {
obj = null;
}
if (xref[k2 + 1] > 0) {
obj = ReadOneObjStm((PRStream)obj, xref[k2]);
}
xrefObj[k] = obj;
return obj;
}