Reviewed By: sblackshear Differential Revision: D7685918 fbshipit-source-id: 0ec46f2master
parent
7a9009e467
commit
a4a1a9c55e
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue