Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Hilbert II - JAVA-Packages - Principia Mathematica II
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.meyling.principia.io
Class Input

    java.lang.Object
      com.meyling.principia.io.Input

public class Input
extends Object

This class provides convenient methods for parsing input. TODO offer input stream constructor

Version:
  $Revision: 1.4 $
Author:
  Michael Meyling

Constructor Summary
`Input(String source)` Constructor using `String` source.
`Input(StringBuffer source)` Constructor using `StringBuffer` source.

Method Summary
`char` | `getChar()` Reads a single character and does not change the reading position.
`char` | `getChar(int i)` Reads a single character and does not change the reading position.
`int` | `getLineNumber()` Returns the current line number.
`boolean` | `isEmpty()` Is there no data left for reading?
`char` | `readChar()` Reads a single character and increments the reading position by one.
`int` | `readCounter()` Reads the next positive integer made completly out of digits, leading whitespace is skipped.
`String` | `readLetterDigitString()` Reads the next string containing only letters or digits, leading whitespace is skipped.
`String` | `readQuoted()` Reads the next quoted string, leading whitespace is skipped.
`String` | `showLinePosition()` Show reading position.
`void` | `skipWhiteSpace()` Skips white space, beginning from reading position.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Input

    public Input(StringBuffer source)

  Constructor using `StringBuffer` source.

Parameters:
  `source` - data source
Throws:
  `IllegalArgumentException` - if argument was an nullpointer

### Input

    public Input(String source)

  Constructor using `String` source.

Parameters:
  `source` - data source
Throws:
  `IllegalArgumentException` - if argument was an nullpointer

Method Detail

### readChar

    public final char readChar()

  Reads a single character and increments the reading position by one.

  Returns:
    character read, if there are no more chars `Character.MAX_VALUE` is returned

### getChar

    public final char getChar()

  Reads a single character and does not change the reading position.

  Returns:
    character read, if there are no more chars `Character.MAX_VALUE` is returned

### getChar

    public final char getChar(int i)

  Reads a single character and does not change the reading position.

  Parameters:
    `i` - offset from current reading position.
  Returns:
    character read, if there are no more chars `Character.MAX_VALUE` is returned

### getLineNumber

    public final int getLineNumber()

  Returns the current line number.

  Returns:
    current line number

### skipWhiteSpace

    public final void skipWhiteSpace()

  Skips white space, beginning from reading position. Changes reading position to next non white space character.

### isEmpty

    public final boolean isEmpty()

  Is there no data left for reading?

  Returns:
    is all data read?

### readLetterDigitString

    public final String readLetterDigitString()

  Reads the next string containing only letters or digits, leading whitespace is skipped. Changes reading position.

  Returns:
    read string
  Throws:
    `IllegalArgumentException` - if no such characters could be found

### readCounter

    public final int readCounter()

  Reads the next positive integer made completly out of digits, leading whitespace is skipped. Changes reading position.

  Returns:
    read integer
  Throws:
    `IllegalArgumentException` - if no digits where found or the number was to big for an `int`

### readQuoted

    public final String readQuoted()
                            throws IllegalArgumentException

  Reads the next quoted string, leading whitespace is skipped. A correctly quoted string could be created by adding a leading and a trailing quote character and doubling each other quote character. The resulting string is dequoted. Changes reading position.

  Returns:
    deqoted read string
  Throws:
    `IllegalArgumentException` - if no correctly quoted string was found

### showLinePosition

    public final String showLinePosition()

  Show reading position.

  Returns:
    current line with mark at current reading position

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Hilbert II - JAVA-Packages - Principia Mathematica II
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

©left GNU General Public Licence All Rights Reserved.