@@ -892,11 +892,15 @@ protected PdfObject readObject(boolean readAsDirect, boolean objStm) throws IOEx
892
892
do {
893
893
ch = tokens .read ();
894
894
} while (ch == 32 || ch == 9 || ch == 0 || ch == 12 );
895
- if (ch != '\n' )
895
+ if (ch != '\n' ) {
896
896
ch = tokens .read ();
897
- if (ch != '\n' )
897
+ }
898
+ if (ch != '\n' ) {
898
899
tokens .backOnePosition (ch );
899
- return new PdfStream (tokens .getPosition (), dict );
900
+ }
901
+ PdfStream pdfStream = new PdfStream (tokens .getPosition (), dict );
902
+ tokens .seek (pdfStream .getOffset () + pdfStream .getLength ());
903
+ return pdfStream ;
900
904
} else {
901
905
tokens .seek (pos );
902
906
return dict ;
@@ -953,11 +957,13 @@ protected PdfDictionary readDictionary(boolean objStm) throws IOException {
953
957
PdfDictionary dic = new PdfDictionary ();
954
958
while (true ) {
955
959
tokens .nextValidToken ();
956
- if (tokens .getTokenType () == PdfTokenizer .TokenType .EndDic )
960
+ if (tokens .getTokenType () == PdfTokenizer .TokenType .EndDic ) {
957
961
break ;
958
- if (tokens .getTokenType () != PdfTokenizer .TokenType .Name )
962
+ }
963
+ if (tokens .getTokenType () != PdfTokenizer .TokenType .Name ) {
959
964
tokens .throwError (
960
965
KernelExceptionMessageConstant .THIS_DICTIONARY_KEY_IS_NOT_A_NAME , tokens .getStringValue ());
966
+ }
961
967
PdfName name = readPdfName (true );
962
968
PdfObject obj = readObject (true , objStm );
963
969
if (obj == null ) {
@@ -1302,7 +1308,8 @@ protected void rebuildXref() throws IOException {
1302
1308
tokens .seek (0 );
1303
1309
trailer = null ;
1304
1310
ByteBuffer buffer = new ByteBuffer (24 );
1305
- PdfTokenizer lineTokeniser = new PdfTokenizer (new RandomAccessFileOrArray (new ReusableRandomAccessSource (buffer )));
1311
+ PdfTokenizer lineTokenizer =
1312
+ new PdfTokenizer (new RandomAccessFileOrArray (new ReusableRandomAccessSource (buffer )));
1306
1313
for (; ; ) {
1307
1314
long pos = tokens .getPosition ();
1308
1315
buffer .reset ();
@@ -1326,7 +1333,7 @@ protected void rebuildXref() throws IOException {
1326
1333
tokens .seek (pos );
1327
1334
}
1328
1335
} else if (buffer .get (0 ) >= '0' && buffer .get (0 ) <= '9' ) {
1329
- int [] obj = PdfTokenizer .checkObjectStart (lineTokeniser );
1336
+ int [] obj = PdfTokenizer .checkObjectStart (lineTokenizer );
1330
1337
if (obj == null )
1331
1338
continue ;
1332
1339
int num = obj [0 ];
0 commit comments