iTextSharp.text.pdf.PRTokeniser.NextValidToken C# (CSharp) Метод

NextValidToken() публичный Метод

public NextValidToken ( ) : void
Результат void
        public void NextValidToken() {
            int level = 0;
            string n1 = null;
            string n2 = null;
            int ptr = 0;
            while (NextToken()) {
                if (type == TK_COMMENT)
                    continue;
                switch (level) {
                    case 0: {
                        if (type != TK_NUMBER)
                            return;
                        ptr = file.FilePointer;
                        n1 = stringValue;
                        ++level;
                        break;
                    }
                    case 1: {
                        if (type != TK_NUMBER) {
                            file.Seek(ptr);
                            type = TK_NUMBER;
                            stringValue = n1;
                            return;
                        }
                        n2 = stringValue;
                        ++level;
                        break;
                    }
                    default: {
                        if (type != TK_OTHER || !stringValue.Equals("R")) {
                            file.Seek(ptr);
                            type = TK_NUMBER;
                            stringValue = n1;
                            return;
                        }
                        type = TK_REF;
                        reference = int.Parse(n1);
                        generation = int.Parse(n2);
                        return;
                    }
                }
            }
            // if we hit here, the file is either corrupt (stream ended unexpectedly),
            // or the last token ended exactly at the end of a stream.  This last
            // case can occur inside an Object Stream.
        }
    

Usage Example

Пример #1
0
        private void CheckNumberValue(String data, String expectedValue) {
            PRTokeniser tok = new PRTokeniser(new RandomAccessFileOrArray(GetBytes(data)));

            tok.NextValidToken();
            Assert.AreEqual(PRTokeniser.TokType.NUMBER, tok.TokenType, "Wrong type");
            Assert.AreEqual(expectedValue, tok.StringValue, "Wrong multiple minus signs number handling");
        }
All Usage Examples Of iTextSharp.text.pdf.PRTokeniser::NextValidToken