minor fix
This commit is contained in:
parent
cf044dda80
commit
5e46e9278c
|
@ -111,11 +111,11 @@ public class JavaReadFromFileUnitTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenReadUTFEncodedFile_thenCorrect() throws IOException {
|
public void whenReadUTFEncodedFile_thenCorrect() throws IOException {
|
||||||
final String expected_value = "�空";
|
final String expected_value = "青空";
|
||||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("src/test/resources/test_read7.in"), "UTF-8"));
|
final BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("src/test/resources/test_read7.in"), "UTF-8"));
|
||||||
final String currentLine = reader.readLine();
|
final String currentLine = reader.readLine();
|
||||||
reader.close();
|
reader.close();
|
||||||
|
System.out.println(currentLine);
|
||||||
assertEquals(expected_value, currentLine);
|
assertEquals(expected_value, currentLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,8 +143,9 @@ public class JavaReadFromFileUnitTest {
|
||||||
final FileChannel channel = reader.getChannel();
|
final FileChannel channel = reader.getChannel();
|
||||||
|
|
||||||
int bufferSize = 1024;
|
int bufferSize = 1024;
|
||||||
if (bufferSize > channel.size())
|
if (bufferSize > channel.size()) {
|
||||||
bufferSize = (int) channel.size();
|
bufferSize = (int) channel.size();
|
||||||
|
}
|
||||||
final ByteBuffer buff = ByteBuffer.allocate(bufferSize);
|
final ByteBuffer buff = ByteBuffer.allocate(bufferSize);
|
||||||
channel.read(buff);
|
channel.read(buff);
|
||||||
buff.flip();
|
buff.flip();
|
||||||
|
|
Loading…
Reference in New Issue