forked from jankotek/mapdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIO.java
More file actions
37 lines (29 loc) · 1.02 KB
/
Copy pathIO.java
File metadata and controls
37 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package org.mapdb.util;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
public class IO {
public static long readLong(DataInputStream in) throws IOException {
return in.readLong();
}
public static int readInt(DataInputStream in) throws IOException {
return in.readInt();
}
public static byte[] readByteArray(InputStream is, int size) throws IOException {
byte[] buf = new byte[size];
int read = is.read(buf, 0, size);
if(read!=size)
throw new IOException("not fully read"); //TODO read fully
return buf;
}
public static void writeLong(DataOutputStream out, long value) throws IOException {
out.writeLong(value);
}
public static void writeInt(DataOutputStream out, int value) throws IOException {
out.writeInt(value);
}
public static void writeByteArray(DataOutputStream out, byte[] buf) throws IOException {
out.write(buf);
}
}