Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,20 @@
|
|||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class Program {
|
||||
private final FileReader reader;
|
||||
|
||||
public Program(String path) throws IOException {
|
||||
reader = new FileReader(path, StandardCharsets.UTF_16);
|
||||
}
|
||||
|
||||
/** @return integer value from 0 to 0xffff, or -1 for EOS */
|
||||
public int nextCharacter() throws IOException {
|
||||
return reader.read();
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
reader.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public final class ReadFileByCharacter {
|
||||
|
||||
public static void main(String[] aArgs) {
|
||||
Path path = Path.of("input.txt");
|
||||
|
||||
try ( BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8) ) {
|
||||
int value;
|
||||
while ( ( value = reader.read() ) != END_OF_STREAM ) {
|
||||
System.out.println((char) value);
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static final int END_OF_STREAM = -1;
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue