summaryrefslogtreecommitdiffstats
path: root/documentapi
diff options
context:
space:
mode:
authorHaakon Dybdahl <dybdahl@yahoo-inc.com>2017-03-23 12:59:27 +0100
committerHaakon Dybdahl <dybdahl@yahoo-inc.com>2017-03-23 12:59:27 +0100
commit2dcc5fa3dc3a2e6d070406010db96f243bd634b4 (patch)
treefb692e0feb054f83cf8276526e31f47d4c65b80e /documentapi
parent146da74b3b165289dfa3272183074b17ca61476c (diff)
Fix loading of file so it loads full file every time.
Diffstat (limited to 'documentapi')
-rw-r--r--documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/TestFileUtil.java13
1 files changed, 3 insertions, 10 deletions
diff --git a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/TestFileUtil.java b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/TestFileUtil.java
index fa5e54d981f..92d8f730339 100644
--- a/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/TestFileUtil.java
+++ b/documentapi/src/test/java/com/yahoo/documentapi/messagebus/protocol/test/TestFileUtil.java
@@ -1,10 +1,11 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.documentapi.messagebus.protocol.test;
-import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Paths;
public class TestFileUtil {
protected static final String DATA_PATH = "./test/crosslanguagefiles";
@@ -33,14 +34,6 @@ public class TestFileUtil {
}
public static byte[] readFile(String path) throws IOException {
- try (FileInputStream stream = new FileInputStream(path)) {
- byte[] data = new byte[stream.available()];
- int read = stream.read(data);
- if (read != data.length) {
- throw new IOException(String.format("Truncated read (expected %d bytes, read %d)", data.length, read));
- }
- return data;
- }
+ return Files.readAllBytes(Paths.get(path));
}
-
}