1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
package org.apache.giraph.utils; |
19 | |
|
20 | |
import java.io.ByteArrayInputStream; |
21 | |
import java.io.DataInput; |
22 | |
import java.io.DataInputStream; |
23 | |
import java.io.IOException; |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
public class ExtendedByteArrayDataInput extends ByteArrayInputStream |
29 | |
implements ExtendedDataInput { |
30 | |
|
31 | |
private final DataInput dataInput; |
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
public ExtendedByteArrayDataInput(byte[] buf) { |
38 | 0 | super(buf); |
39 | 0 | dataInput = new DataInputStream(this); |
40 | 0 | } |
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
public ExtendedByteArrayDataInput(byte[] buf, int offset, int length) { |
50 | 0 | super(buf, offset, length); |
51 | 0 | dataInput = new DataInputStream(this); |
52 | 0 | } |
53 | |
|
54 | |
@Override |
55 | |
public int getPos() { |
56 | 0 | return pos; |
57 | |
} |
58 | |
|
59 | |
@Override |
60 | |
public boolean endOfInput() { |
61 | 0 | return available() == 0; |
62 | |
} |
63 | |
|
64 | |
@Override |
65 | |
public void readFully(byte[] b) throws IOException { |
66 | 0 | dataInput.readFully(b); |
67 | 0 | } |
68 | |
|
69 | |
@Override |
70 | |
public void readFully(byte[] b, int off, int len) throws IOException { |
71 | 0 | dataInput.readFully(b, off, len); |
72 | 0 | } |
73 | |
|
74 | |
@Override |
75 | |
public int skipBytes(int n) throws IOException { |
76 | 0 | return dataInput.skipBytes(n); |
77 | |
} |
78 | |
|
79 | |
@Override |
80 | |
public boolean readBoolean() throws IOException { |
81 | 0 | return dataInput.readBoolean(); |
82 | |
} |
83 | |
|
84 | |
@Override |
85 | |
public byte readByte() throws IOException { |
86 | 0 | return dataInput.readByte(); |
87 | |
} |
88 | |
|
89 | |
@Override |
90 | |
public int readUnsignedByte() throws IOException { |
91 | 0 | return dataInput.readUnsignedByte(); |
92 | |
} |
93 | |
|
94 | |
@Override |
95 | |
public short readShort() throws IOException { |
96 | 0 | return dataInput.readShort(); |
97 | |
} |
98 | |
|
99 | |
@Override |
100 | |
public int readUnsignedShort() throws IOException { |
101 | 0 | return dataInput.readUnsignedShort(); |
102 | |
} |
103 | |
|
104 | |
@Override |
105 | |
public char readChar() throws IOException { |
106 | 0 | return dataInput.readChar(); |
107 | |
} |
108 | |
|
109 | |
@Override |
110 | |
public int readInt() throws IOException { |
111 | 0 | return dataInput.readInt(); |
112 | |
} |
113 | |
|
114 | |
@Override |
115 | |
public long readLong() throws IOException { |
116 | 0 | return dataInput.readLong(); |
117 | |
} |
118 | |
|
119 | |
@Override |
120 | |
public float readFloat() throws IOException { |
121 | 0 | return dataInput.readFloat(); |
122 | |
} |
123 | |
|
124 | |
@Override |
125 | |
public double readDouble() throws IOException { |
126 | 0 | return dataInput.readDouble(); |
127 | |
} |
128 | |
|
129 | |
@Override |
130 | |
public String readLine() throws IOException { |
131 | 0 | return dataInput.readLine(); |
132 | |
} |
133 | |
|
134 | |
@Override |
135 | |
public String readUTF() throws IOException { |
136 | 0 | return dataInput.readUTF(); |
137 | |
} |
138 | |
} |