Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 6 additions & 17 deletions client/src/com/aerospike/client/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,12 @@ public static String getStackTrace(Throwable e) {
}

public static byte[] readFile(File file) {
try {
byte[] bytes = new byte[(int)file.length()];

try (FileInputStream in = new FileInputStream(file)) {
int pos = 0;
int len = 0;

while (pos < bytes.length) {
len = in.read(bytes, pos, bytes.length - pos);
pos += len;
}
return bytes;
}
}
catch (Throwable e) {
throw new AerospikeException("Failed to read " + file.getAbsolutePath(), e);
}
try (FileInputStream fis = new FileInputStream(file)) {
return fis.readAllBytes();
}
catch (Throwable e) {
throw new AerospikeException("Failed to read " + file.getAbsolutePath(), e);
}
}

public static byte[] readResource(ClassLoader resourceLoader, String resourcePath) {
Expand Down