File tree Expand file tree Collapse file tree
main/java/org/apache/commons/csv
test/java/org/apache/commons/csv Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919
2020import java .io .IOException ;
2121
22- import static org .apache .commons .csv .CSVLexer . Token .Type .*;
22+ import static org .apache .commons .csv .Token .Type .*;
2323
2424class CSVLexer {
2525
26- /** length of the initial token (content-)buffer */
27- private static final int INITIAL_TOKEN_LENGTH = 50 ;
28-
2926 private final StringBuilder wsBuf = new StringBuilder ();
3027
3128 private final CSVFormat format ;
3229
3330 /** The input stream */
3431 private final ExtendedBufferedReader in ;
3532
36- /**
37- * Token is an internal token representation.
38- * <p/>
39- * It is used as contract between the lexer and the parser.
40- */
41- static class Token {
42-
43- enum Type {
44- /** Token has no valid content, i.e. is in its initialized state. */
45- INVALID ,
46-
47- /** Token with content, at beginning or in the middle of a line. */
48- TOKEN ,
49-
50- /** Token (which can have content) when end of file is reached. */
51- EOF ,
52-
53- /** Token with content when end of a line is reached. */
54- EORECORD
55- }
56-
57- /** Token type */
58- Type type = INVALID ;
59-
60- /** The content buffer. */
61- StringBuilder content = new StringBuilder (INITIAL_TOKEN_LENGTH );
62-
63- /** Token ready flag: indicates a valid token with content (ready for the parser). */
64- boolean isReady ;
65-
66- Token reset () {
67- content .setLength (0 );
68- type = INVALID ;
69- isReady = false ;
70- return this ;
71- }
72- }
73-
7433 CSVLexer (CSVFormat format , ExtendedBufferedReader in ) {
7534 this .format = format ;
7635 this .in = in ;
Original file line number Diff line number Diff line change 2727import java .util .Map ;
2828import java .util .NoSuchElementException ;
2929
30- import org .apache .commons .csv .CSVLexer .Token ;
3130
32- import static org .apache .commons .csv .CSVLexer . Token .Type .*;
31+ import static org .apache .commons .csv .Token .Type .*;
3332
3433/**
3534 * Parses CSV files according to the specified configuration.
Original file line number Diff line number Diff line change 2020import java .io .IOException ;
2121import java .io .StringReader ;
2222
23- import org .apache .commons .csv .CSVLexer .Token ;
2423import org .junit .Test ;
2524
26- import static org .apache .commons .csv .CSVLexer . Token .Type .*;
25+ import static org .apache .commons .csv .Token .Type .*;
2726import static org .junit .Assert .*;
2827
2928public class CSVLexerTest {
You can’t perform that action at this time.
0 commit comments