You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.6 KiB
71 lines
1.6 KiB
7 years ago
|
/*
|
||
|
* Copyright (c) 2018 - present Facebook, Inc.
|
||
|
* All rights reserved.
|
||
|
*
|
||
|
* This source code is licensed under the BSD style license found in the
|
||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||
|
*/
|
||
|
|
||
|
import java.io.FileReader;
|
||
|
import java.io.DataInputStream;
|
||
|
import java.io.FileWriter;
|
||
|
import java.io.DataOutputStream;
|
||
|
import java.io.IOException;
|
||
|
import android.support.annotation.UiThread;
|
||
|
|
||
|
class JavaIO {
|
||
|
FileReader reader;
|
||
|
DataInputStream inputStream;
|
||
|
FileWriter writer;
|
||
|
DataOutputStream outputStream;
|
||
|
|
||
|
int doFileRead() throws IOException {
|
||
|
return reader.read();
|
||
|
}
|
||
|
|
||
|
String doStreamRead() throws IOException {
|
||
|
return inputStream.readUTF();
|
||
|
}
|
||
|
|
||
|
@UiThread
|
||
|
void fileReadBad() throws IOException {
|
||
|
doFileRead();
|
||
|
}
|
||
|
|
||
|
@UiThread
|
||
|
void streamReadBad() throws IOException {
|
||
|
doStreamRead();
|
||
|
}
|
||
|
|
||
|
@UiThread
|
||
|
void writerMethodsOk() throws IOException {
|
||
|
writer = new FileWriter("bla");
|
||
|
writer.write('a');
|
||
|
writer.append('b');
|
||
|
String enc = writer.getEncoding();
|
||
|
}
|
||
|
|
||
|
@UiThread
|
||
|
void readerMethodsOk() throws IOException {
|
||
|
reader = new FileReader("bla");
|
||
|
String enc = reader.getEncoding();
|
||
|
reader.markSupported();
|
||
|
reader.reset();
|
||
|
reader.close();
|
||
|
}
|
||
|
|
||
|
@UiThread
|
||
|
void outputStreamMethodsOk() throws IOException {
|
||
|
outputStream.write('a');
|
||
|
outputStream.size();
|
||
|
}
|
||
|
|
||
|
@UiThread
|
||
|
void inputStreamMethodsOk() throws IOException {
|
||
|
inputStream.available();
|
||
|
inputStream.reset();
|
||
|
inputStream.close();
|
||
|
}
|
||
|
}
|