forked from ivanhk/fastText_java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLineReader.java
More file actions
54 lines (43 loc) · 1.36 KB
/
Copy pathLineReader.java
File metadata and controls
54 lines (43 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package fasttext.io;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
public abstract class LineReader extends Reader {
protected InputStream inputStream_ = null;
protected File file_ = null;
protected Charset charset_ = null;
protected LineReader() {
super();
}
protected LineReader(Object lock) {
super(lock);
}
public LineReader(String filename, String charsetName) throws IOException, UnsupportedEncodingException {
this();
this.file_ = new File(filename);
this.charset_ = Charset.forName(charsetName);
}
public LineReader(InputStream inputStream, String charsetName) throws UnsupportedEncodingException {
this();
this.inputStream_ = inputStream;
this.charset_ = Charset.forName(charsetName);
}
/**
* Skips lines.
*
* @param n
* The number of lines to skip
* @return The number of lines actually skipped
* @exception IOException
* If an I/O error occurs
* @exception IllegalArgumentException
* If <code>n</code> is negative.
*/
public abstract long skipLine(long n) throws IOException;
public abstract String readLine() throws IOException;
public abstract String[] readLineTokens() throws IOException;
public abstract void rewind() throws IOException;
}