Skip to contentMethod: TypeFileScanner(Buffer)
      1: package scanner;
2: 
3: import java.io.IOException;
4: import java.io.InputStream;
5: 
6: import symbols.AbstractSymbol;
7: import basic.Buffer;
8: 
9: /**
10:  * This class represent the scanner for a TypeFile.
11:  * 
12:  * @author HFW410
13:  * 
14:  */
15: public final class TypeFileScanner extends Scanner {
16: 
17:         /**
18:          * This is the constructor for a new TypeFileScanner.
19:          * 
20:          * @param buffer
21:          *            is the Buffer of Symbols
22:          */
23:         private TypeFileScanner(final Buffer<AbstractSymbol> buffer) {
24:                 super(buffer);
25:         }
26: 
27:         /**
28:          * creates a scanner and starts him.
29:          * 
30:          * @param input
31:          *            is the input stream.
32:          * @param dataPath
33:          *            is the path of the file.
34:          * @param buffer
35:          *            if the buffer for the symbols.
36:          * @throws IOException
37:          *             from the Input Stream.
38:          * @throws InterruptedException
39:          *             from the buffer.
40:          * @throws ScannerException
41:          *             if there is any problem during the scan.
42:          */
43:         public static void toSymbolSequence(final InputStream input, final String dataPath,
44:                         final Buffer<AbstractSymbol> buffer) throws ScannerException, InterruptedException,
45:                         IOException {
46:                 final TypeFileScanner scanner = new TypeFileScanner(buffer);
47:                 toSymbolSequence(input, dataPath, scanner);
48:         }
49: 
50:         @Override
51:         protected AbstractState getSelectionState() {
52:                 return new SelectionState(this, this.getColumnCounter(), this.getRowCounter());
53:         }
54: 
55:         @Override
56:         protected AbstractState
57:                         getRestState(final Integer beginningRow, final Integer beginningColumn) {
58:                 return new TypeFileRestState(this, beginningColumn, beginningRow);
59:         }
60: 
61: }