summaryrefslogtreecommitdiffstats
path: root/sched
diff options
context:
space:
mode:
authormikaelpeltier <mikaelpeltier@google.com>2015-03-23 09:11:11 +0100
committermikaelpeltier <mikaelpeltier@google.com>2015-03-23 10:58:35 +0100
commitd114084922f839f36d5c6d98e2f250e11eacc39d (patch)
treea8bd2bbee1e546819faa137e9df75347dcfe6c8c /sched
parentfeecce3a2b4e569a6d5aa97222ded0e6c14e696f (diff)
downloadtoolchain_jack-d114084922f839f36d5c6d98e2f250e11eacc39d.zip
toolchain_jack-d114084922f839f36d5c6d98e2f250e11eacc39d.tar.gz
toolchain_jack-d114084922f839f36d5c6d98e2f250e11eacc39d.tar.bz2
Add InputStreamProvider and OutputStreamProvider
- Add common interface between VFile and StreamFile that will allow to read or write them. Change-Id: I1721932c7e68770edae53a431d4a9a3ca664ae72
Diffstat (limited to 'sched')
-rw-r--r--sched/src/com/android/sched/util/file/InputStreamFile.java4
-rw-r--r--sched/src/com/android/sched/util/file/OutputStreamFile.java5
-rw-r--r--sched/src/com/android/sched/vfs/BaseVFile.java11
-rw-r--r--sched/src/com/android/sched/vfs/CaseInsensitiveFS.java11
-rw-r--r--sched/src/com/android/sched/vfs/GenericInputOutputVFile.java17
-rw-r--r--sched/src/com/android/sched/vfs/GenericInputVFile.java6
-rw-r--r--sched/src/com/android/sched/vfs/GenericOutputVFile.java13
-rw-r--r--sched/src/com/android/sched/vfs/InputStreamProvider.java32
-rw-r--r--sched/src/com/android/sched/vfs/InputVFile.java11
-rw-r--r--sched/src/com/android/sched/vfs/MessageDigestFS.java12
-rw-r--r--sched/src/com/android/sched/vfs/MessageDigestInputVFS.java7
-rw-r--r--sched/src/com/android/sched/vfs/MessageDigestOutputVFS.java13
-rw-r--r--sched/src/com/android/sched/vfs/OutputStreamProvider.java36
-rw-r--r--sched/src/com/android/sched/vfs/OutputVFile.java10
-rw-r--r--sched/src/com/android/sched/vfs/VFSToVFSWrapper.java4
-rw-r--r--sched/src/com/android/sched/vfs/VFile.java10
-rw-r--r--sched/tests/com/android/sched/vfs/VFSTest.java4
17 files changed, 143 insertions, 63 deletions
diff --git a/sched/src/com/android/sched/util/file/InputStreamFile.java b/sched/src/com/android/sched/util/file/InputStreamFile.java
index 1aa3b4f..60f493a 100644
--- a/sched/src/com/android/sched/util/file/InputStreamFile.java
+++ b/sched/src/com/android/sched/util/file/InputStreamFile.java
@@ -21,6 +21,7 @@ import com.android.sched.util.location.FileLocation;
import com.android.sched.util.location.Location;
import com.android.sched.util.location.StandardInputLocation;
import com.android.sched.util.stream.UncloseableInputStream;
+import com.android.sched.vfs.InputStreamProvider;
import java.io.File;
import java.io.FileInputStream;
@@ -33,7 +34,7 @@ import javax.annotation.Nonnull;
/**
* Class representing a input stream from a file path or a standard input.
*/
-public class InputStreamFile extends AbstractStreamFile {
+public class InputStreamFile extends AbstractStreamFile implements InputStreamProvider {
@CheckForNull
private InputStream stream;
@@ -72,6 +73,7 @@ public class InputStreamFile extends AbstractStreamFile {
}
}
+ @Override
@Nonnull
public InputStream getInputStream() {
if (stream == null) {
diff --git a/sched/src/com/android/sched/util/file/OutputStreamFile.java b/sched/src/com/android/sched/util/file/OutputStreamFile.java
index 0b78ebb..37907b2 100644
--- a/sched/src/com/android/sched/util/file/OutputStreamFile.java
+++ b/sched/src/com/android/sched/util/file/OutputStreamFile.java
@@ -23,6 +23,7 @@ import com.android.sched.util.location.Location;
import com.android.sched.util.location.StandardErrorLocation;
import com.android.sched.util.location.StandardOutputLocation;
import com.android.sched.util.stream.UncloseablePrintStream;
+import com.android.sched.vfs.OutputStreamProvider;
import java.io.File;
import java.io.FileNotFoundException;
@@ -36,7 +37,7 @@ import javax.annotation.Nonnull;
/**
* Class representing a output stream from a file path or a standard output.
*/
-public class OutputStreamFile extends AbstractStreamFile {
+public class OutputStreamFile extends AbstractStreamFile implements OutputStreamProvider {
private final boolean append;
@CheckForNull
@@ -201,6 +202,7 @@ public class OutputStreamFile extends AbstractStreamFile {
this.append = true;
}
+ @Override
@Nonnull
public OutputStream getOutputStream() {
if (stream == null) {
@@ -216,6 +218,7 @@ public class OutputStreamFile extends AbstractStreamFile {
return stream;
}
+ @Override
@Nonnull
public PrintStream getPrintStream() {
if (printer == null) {
diff --git a/sched/src/com/android/sched/vfs/BaseVFile.java b/sched/src/com/android/sched/vfs/BaseVFile.java
index 387471c..3520eb6 100644
--- a/sched/src/com/android/sched/vfs/BaseVFile.java
+++ b/sched/src/com/android/sched/vfs/BaseVFile.java
@@ -22,6 +22,7 @@ import com.android.sched.util.location.Location;
import java.io.InputStream;
import java.io.OutputStream;
+import java.io.PrintStream;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
@@ -37,7 +38,7 @@ abstract class BaseVFile extends BaseVElement implements VFile {
@Override
@Nonnull
- public InputStream openRead() throws WrongPermissionException {
+ public InputStream getInputStream() throws WrongPermissionException {
return vfs.openRead(this);
}
@@ -48,12 +49,18 @@ abstract class BaseVFile extends BaseVElement implements VFile {
@Override
@Nonnull
- public OutputStream openWrite() throws WrongPermissionException {
+ public OutputStream getOutputStream() throws WrongPermissionException {
return vfs.openWrite(this);
}
@Override
@Nonnull
+ public PrintStream getPrintStream() throws WrongPermissionException {
+ return new PrintStream(getOutputStream());
+ }
+
+ @Override
+ @Nonnull
public Location getLocation() {
return vfs.getVFileLocation(this);
}
diff --git a/sched/src/com/android/sched/vfs/CaseInsensitiveFS.java b/sched/src/com/android/sched/vfs/CaseInsensitiveFS.java
index 1c81dfa..1807333 100644
--- a/sched/src/com/android/sched/vfs/CaseInsensitiveFS.java
+++ b/sched/src/com/android/sched/vfs/CaseInsensitiveFS.java
@@ -178,7 +178,7 @@ public class CaseInsensitiveFS extends BaseVFS<CaseInsensitiveVDir, CaseInsensit
}
try {
- reader = new LineNumberReader(new InputStreamReader(file.openRead()));
+ reader = new LineNumberReader(new InputStreamReader(file.getInputStream()));
} catch (WrongPermissionException e) {
throw new WrongVFSFormatException(this, vfs.getLocation(), e);
}
@@ -251,14 +251,15 @@ public class CaseInsensitiveFS extends BaseVFS<CaseInsensitiveVDir, CaseInsensit
@Override
public synchronized void close() throws IOException {
if (!closed) {
- PrintStream printer = new PrintStream(vfs.getRootDir().createVFile(INDEX_NAME).openWrite());
+ PrintStream printer =
+ new PrintStream(vfs.getRootDir().createVFile(INDEX_NAME).getOutputStream());
printIndex(printer, getRootDir());
printer.flush();
printer.close();
if (debug) {
- printer = new PrintStream(vfs.getRootDir().createVFile(DEBUG_NAME).openWrite());
+ printer = new PrintStream(vfs.getRootDir().createVFile(DEBUG_NAME).getOutputStream());
printDebug(printer, getRootDir());
printer.flush();
@@ -322,7 +323,7 @@ public class CaseInsensitiveFS extends BaseVFS<CaseInsensitiveVDir, CaseInsensit
InputStream openRead(@Nonnull CaseInsensitiveVFile file) throws WrongPermissionException {
assert !isClosed();
- return file.getEncodedFile().openRead();
+ return file.getEncodedFile().getInputStream();
}
@Override
@@ -330,7 +331,7 @@ public class CaseInsensitiveFS extends BaseVFS<CaseInsensitiveVDir, CaseInsensit
OutputStream openWrite(@Nonnull CaseInsensitiveVFile file) throws WrongPermissionException {
assert !isClosed();
- return file.getEncodedFile().openWrite();
+ return file.getEncodedFile().getOutputStream();
}
//
diff --git a/sched/src/com/android/sched/vfs/GenericInputOutputVFile.java b/sched/src/com/android/sched/vfs/GenericInputOutputVFile.java
index be15c32..ec73117 100644
--- a/sched/src/com/android/sched/vfs/GenericInputOutputVFile.java
+++ b/sched/src/com/android/sched/vfs/GenericInputOutputVFile.java
@@ -17,11 +17,12 @@
package com.android.sched.vfs;
import com.android.sched.util.file.CannotDeleteFileException;
+import com.android.sched.util.file.WrongPermissionException;
import com.android.sched.util.location.Location;
-import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.io.PrintStream;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
@@ -56,14 +57,20 @@ public class GenericInputOutputVFile implements InputOutputVFile {
@Override
@Nonnull
- public InputStream openRead() throws IOException {
- return file.openRead();
+ public InputStream getInputStream() throws WrongPermissionException {
+ return file.getInputStream();
}
@Override
@Nonnull
- public OutputStream openWrite() throws IOException {
- return file.openWrite();
+ public OutputStream getOutputStream() throws WrongPermissionException {
+ return file.getOutputStream();
+ }
+
+ @Override
+ @Nonnull
+ public PrintStream getPrintStream() throws WrongPermissionException {
+ return new PrintStream(getOutputStream());
}
@Override
diff --git a/sched/src/com/android/sched/vfs/GenericInputVFile.java b/sched/src/com/android/sched/vfs/GenericInputVFile.java
index 3f850c3..b203dbc 100644
--- a/sched/src/com/android/sched/vfs/GenericInputVFile.java
+++ b/sched/src/com/android/sched/vfs/GenericInputVFile.java
@@ -17,9 +17,9 @@
package com.android.sched.vfs;
import com.android.sched.util.file.CannotDeleteFileException;
+import com.android.sched.util.file.WrongPermissionException;
import com.android.sched.util.location.Location;
-import java.io.IOException;
import java.io.InputStream;
import javax.annotation.CheckForNull;
@@ -55,8 +55,8 @@ public class GenericInputVFile implements InputVFile {
@Override
@Nonnull
- public InputStream openRead() throws IOException {
- return file.openRead();
+ public InputStream getInputStream() throws WrongPermissionException {
+ return file.getInputStream();
}
@Override
diff --git a/sched/src/com/android/sched/vfs/GenericOutputVFile.java b/sched/src/com/android/sched/vfs/GenericOutputVFile.java
index a340ab2..87cbeb8 100644
--- a/sched/src/com/android/sched/vfs/GenericOutputVFile.java
+++ b/sched/src/com/android/sched/vfs/GenericOutputVFile.java
@@ -16,10 +16,11 @@
package com.android.sched.vfs;
+import com.android.sched.util.file.WrongPermissionException;
import com.android.sched.util.location.Location;
-import java.io.IOException;
import java.io.OutputStream;
+import java.io.PrintStream;
import javax.annotation.Nonnull;
@@ -53,7 +54,13 @@ public class GenericOutputVFile implements OutputVFile {
@Override
@Nonnull
- public OutputStream openWrite() throws IOException {
- return file.openWrite();
+ public OutputStream getOutputStream() throws WrongPermissionException {
+ return file.getOutputStream();
+ }
+
+ @Override
+ @Nonnull
+ public PrintStream getPrintStream() throws WrongPermissionException {
+ return new PrintStream(getOutputStream());
}
} \ No newline at end of file
diff --git a/sched/src/com/android/sched/vfs/InputStreamProvider.java b/sched/src/com/android/sched/vfs/InputStreamProvider.java
new file mode 100644
index 0000000..ec5838b
--- /dev/null
+++ b/sched/src/com/android/sched/vfs/InputStreamProvider.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.sched.vfs;
+
+import com.android.sched.util.file.WrongPermissionException;
+
+import java.io.InputStream;
+
+import javax.annotation.Nonnull;
+
+/**
+ * Provider of {@link InputStream}.
+ */
+public interface InputStreamProvider {
+
+ @Nonnull
+ InputStream getInputStream() throws WrongPermissionException;
+}
diff --git a/sched/src/com/android/sched/vfs/InputVFile.java b/sched/src/com/android/sched/vfs/InputVFile.java
index 817391f..55eed90 100644
--- a/sched/src/com/android/sched/vfs/InputVFile.java
+++ b/sched/src/com/android/sched/vfs/InputVFile.java
@@ -18,19 +18,10 @@ package com.android.sched.vfs;
import com.android.sched.util.file.CannotDeleteFileException;
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.annotation.Nonnull;
-
/**
* Virtual file to read from.
*/
-public interface InputVFile extends InputVElement {
-
- @Nonnull
- InputStream openRead() throws IOException;
+public interface InputVFile extends InputVElement, InputStreamProvider {
void delete() throws CannotDeleteFileException;
-
}
diff --git a/sched/src/com/android/sched/vfs/MessageDigestFS.java b/sched/src/com/android/sched/vfs/MessageDigestFS.java
index d01c1e0..2b414b4 100644
--- a/sched/src/com/android/sched/vfs/MessageDigestFS.java
+++ b/sched/src/com/android/sched/vfs/MessageDigestFS.java
@@ -114,19 +114,19 @@ public class MessageDigestFS extends BaseVFS<BaseVDir, MessageDigestVFile> imple
@Override
@Nonnull
- public InputStream openRead() throws WrongPermissionException {
- return wrappedFile.openRead();
+ public InputStream getInputStream() throws WrongPermissionException {
+ return wrappedFile.getInputStream();
}
@Override
@Nonnull
- public OutputStream openWrite() throws WrongPermissionException {
+ public OutputStream getOutputStream() throws WrongPermissionException {
synchronized (MessageDigestFS.this) {
digests.remove(getPath());
digest = null;
}
- return new DigestOutputStream(wrappedFile.openWrite(), mdFactory.create()) {
+ return new DigestOutputStream(wrappedFile.getOutputStream(), mdFactory.create()) {
@Override
public void close() throws IOException {
super.close();
@@ -172,7 +172,7 @@ public class MessageDigestFS extends BaseVFS<BaseVDir, MessageDigestVFile> imple
LineNumberReader in = null;
try {
try {
- in = new LineNumberReader(new InputStreamReader(digestFile.openRead()));
+ in = new LineNumberReader(new InputStreamReader(digestFile.getInputStream()));
} catch (WrongPermissionException e) {
throw new WrongVFSFormatException(this, vfs.getLocation(), e);
}
@@ -265,7 +265,7 @@ public class MessageDigestFS extends BaseVFS<BaseVDir, MessageDigestVFile> imple
public synchronized void close() throws CannotCreateFileException, WrongPermissionException,
IOException {
if (!closed) {
- printDigest(vfs.getRootDir().createVFile(DIGEST_FILE_NAME).openWrite());
+ printDigest(vfs.getRootDir().createVFile(DIGEST_FILE_NAME).getOutputStream());
vfs.close();
closed = true;
}
diff --git a/sched/src/com/android/sched/vfs/MessageDigestInputVFS.java b/sched/src/com/android/sched/vfs/MessageDigestInputVFS.java
index c2a6d23..6a3bfc9 100644
--- a/sched/src/com/android/sched/vfs/MessageDigestInputVFS.java
+++ b/sched/src/com/android/sched/vfs/MessageDigestInputVFS.java
@@ -19,6 +19,7 @@ package com.android.sched.vfs;
import com.android.sched.util.file.NoSuchFileException;
import com.android.sched.util.file.NotDirectoryException;
import com.android.sched.util.file.NotFileOrDirectoryException;
+import com.android.sched.util.file.WrongPermissionException;
import com.android.sched.util.location.Location;
import com.android.sched.util.log.LoggerFactory;
@@ -86,8 +87,8 @@ public class MessageDigestInputVFS extends MessageDigestVFS implements InputVFS
@Override
@Nonnull
- public InputStream openRead() throws IOException {
- return file.openRead();
+ public InputStream getInputStream() throws WrongPermissionException {
+ return file.getInputStream();
}
@CheckForNull
@@ -182,7 +183,7 @@ public class MessageDigestInputVFS extends MessageDigestVFS implements InputVFS
}
try {
- in = new BufferedReader(new InputStreamReader(file.openRead()));
+ in = new BufferedReader(new InputStreamReader(file.getInputStream()));
} catch (IOException e) {
logger.log(Level.WARNING, "Cannot open {0}", file.getLocation().getDescription());
logger.log(Level.WARNING, "Stacktrace", e);
diff --git a/sched/src/com/android/sched/vfs/MessageDigestOutputVFS.java b/sched/src/com/android/sched/vfs/MessageDigestOutputVFS.java
index 7172e56..6b2ba61 100644
--- a/sched/src/com/android/sched/vfs/MessageDigestOutputVFS.java
+++ b/sched/src/com/android/sched/vfs/MessageDigestOutputVFS.java
@@ -19,6 +19,7 @@ package com.android.sched.vfs;
import com.android.sched.util.collect.Lists;
import com.android.sched.util.config.MessageDigestFactory;
import com.android.sched.util.file.CannotCreateFileException;
+import com.android.sched.util.file.WrongPermissionException;
import com.android.sched.util.location.Location;
import java.io.IOException;
@@ -78,10 +79,10 @@ public class MessageDigestOutputVFS extends MessageDigestVFS implements OutputVF
@Override
@Nonnull
- public OutputStream openWrite() throws IOException {
+ public OutputStream getOutputStream() throws WrongPermissionException {
assert !isClosed();
- return new DigestOutputStream(file.openWrite(),
+ return new DigestOutputStream(file.getOutputStream(),
MessageDigestOutputVFS.this.mdFactory.create()) {
@Override
public void close() throws IOException {
@@ -92,6 +93,12 @@ public class MessageDigestOutputVFS extends MessageDigestVFS implements OutputVF
};
}
+ @Override
+ @Nonnull
+ public PrintStream getPrintStream() throws WrongPermissionException {
+ return new PrintStream(getOutputStream());
+ }
+
@CheckForNull
public String getDigest() {
return digest;
@@ -182,7 +189,7 @@ public class MessageDigestOutputVFS extends MessageDigestVFS implements OutputVF
DigestOutputStream os =
new DigestOutputStream(root.createOutputVFile(new VPath(DIGEST_DIRECTORY_NAME, '/'))
- .openWrite(), MessageDigestOutputVFS.this.mdFactory.create());
+ .getOutputStream(), MessageDigestOutputVFS.this.mdFactory.create());
PrintStream printer = new PrintStream(os);
printer.println(mdFactory.getService().getAlgorithm());
diff --git a/sched/src/com/android/sched/vfs/OutputStreamProvider.java b/sched/src/com/android/sched/vfs/OutputStreamProvider.java
new file mode 100644
index 0000000..00970e0
--- /dev/null
+++ b/sched/src/com/android/sched/vfs/OutputStreamProvider.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.sched.vfs;
+
+import com.android.sched.util.file.WrongPermissionException;
+
+import java.io.OutputStream;
+import java.io.PrintStream;
+
+import javax.annotation.Nonnull;
+
+/**
+ * Provider of {@link OutputStreamProvider}.
+ */
+public interface OutputStreamProvider {
+
+ @Nonnull
+ OutputStream getOutputStream() throws WrongPermissionException;
+
+ @Nonnull
+ PrintStream getPrintStream() throws WrongPermissionException;
+}
diff --git a/sched/src/com/android/sched/vfs/OutputVFile.java b/sched/src/com/android/sched/vfs/OutputVFile.java
index 679d321..9e2de04 100644
--- a/sched/src/com/android/sched/vfs/OutputVFile.java
+++ b/sched/src/com/android/sched/vfs/OutputVFile.java
@@ -16,15 +16,9 @@
package com.android.sched.vfs;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import javax.annotation.Nonnull;
-
/**
* Virtual file to write to.
*/
-public interface OutputVFile extends OutputVElement {
- @Nonnull
- OutputStream openWrite() throws IOException;
+public interface OutputVFile extends OutputVElement, OutputStreamProvider {
+
}
diff --git a/sched/src/com/android/sched/vfs/VFSToVFSWrapper.java b/sched/src/com/android/sched/vfs/VFSToVFSWrapper.java
index 6cb7ee8..7ee1c22 100644
--- a/sched/src/com/android/sched/vfs/VFSToVFSWrapper.java
+++ b/sched/src/com/android/sched/vfs/VFSToVFSWrapper.java
@@ -115,8 +115,8 @@ public class VFSToVFSWrapper extends BaseVFS<BaseVDir, BaseVFile> implements VFS
InputStream is = null;
OutputStream os = null;
try {
- is = ((VFile) element).openRead();
- os = file.openWrite();
+ is = ((VFile) element).getInputStream();
+ os = file.getOutputStream();
ByteStreamSucker sucker = new ByteStreamSucker(is, os);
sucker.suck();
} finally {
diff --git a/sched/src/com/android/sched/vfs/VFile.java b/sched/src/com/android/sched/vfs/VFile.java
index 824bc81..46df79f 100644
--- a/sched/src/com/android/sched/vfs/VFile.java
+++ b/sched/src/com/android/sched/vfs/VFile.java
@@ -17,10 +17,6 @@
package com.android.sched.vfs;
import com.android.sched.util.file.CannotDeleteFileException;
-import com.android.sched.util.file.WrongPermissionException;
-
-import java.io.InputStream;
-import java.io.OutputStream;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
@@ -28,14 +24,10 @@ import javax.annotation.Nonnull;
/**
* Virtual file of a {@link VFS}.
*/
-public interface VFile extends VElement {
+public interface VFile extends VElement, InputStreamProvider, OutputStreamProvider {
@Nonnull
VPath getPath();
- @Nonnull
- InputStream openRead() throws WrongPermissionException;
- @Nonnull
- OutputStream openWrite() throws WrongPermissionException;
@CheckForNull
String getDigest();
diff --git a/sched/tests/com/android/sched/vfs/VFSTest.java b/sched/tests/com/android/sched/vfs/VFSTest.java
index b463cb0..23953fc 100644
--- a/sched/tests/com/android/sched/vfs/VFSTest.java
+++ b/sched/tests/com/android/sched/vfs/VFSTest.java
@@ -803,14 +803,14 @@ public class VFSTest {
}
private void writeToFile(@Nonnull OutputVFile file, @Nonnull String string) throws IOException {
- OutputStreamWriter writer = new OutputStreamWriter(file.openWrite());
+ OutputStreamWriter writer = new OutputStreamWriter(file.getOutputStream());
writer.write(string);
writer.close();
}
@Nonnull
private String readFromFile(@Nonnull InputVFile file) throws IOException {
- BufferedReader reader = new BufferedReader(new InputStreamReader(file.openRead()));
+ BufferedReader reader = new BufferedReader(new InputStreamReader(file.getInputStream()));
String string = reader.readLine();
Assert.assertNull(reader.readLine());
reader.close();