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
38
39
40
41
42
43
44 package org.eclipse.jgit.internal.storage.file;
45
46 import java.io.DataInput;
47 import java.io.IOException;
48 import java.io.InputStream;
49
50 import org.eclipse.jgit.util.IO;
51 import org.eclipse.jgit.util.NB;
52
53
54
55
56
57
58 class SimpleDataInput implements DataInput {
59 private final InputStream fd;
60
61 private final byte[] buf = new byte[8];
62
63 SimpleDataInput(InputStream fd) {
64 this.fd = fd;
65 }
66
67
68 @Override
69 public int readInt() throws IOException {
70 readFully(buf, 0, 4);
71 return NB.decodeInt32(buf, 0);
72 }
73
74
75 @Override
76 public long readLong() throws IOException {
77 readFully(buf, 0, 8);
78 return NB.decodeInt64(buf, 0);
79 }
80
81
82
83
84
85
86
87
88 public long readUnsignedInt() throws IOException {
89 readFully(buf, 0, 4);
90 return NB.decodeUInt32(buf, 0);
91 }
92
93
94 @Override
95 public void readFully(byte[] b) throws IOException {
96 readFully(b, 0, b.length);
97 }
98
99
100 @Override
101 public void readFully(byte[] b, int off, int len) throws IOException {
102 IO.readFully(fd, b, off, len);
103 }
104
105
106 @Override
107 public int skipBytes(int n) throws IOException {
108 throw new UnsupportedOperationException();
109 }
110
111
112 @Override
113 public boolean readBoolean() throws IOException {
114 throw new UnsupportedOperationException();
115 }
116
117
118 @Override
119 public byte readByte() throws IOException {
120 throw new UnsupportedOperationException();
121 }
122
123
124 @Override
125 public int readUnsignedByte() throws IOException {
126 throw new UnsupportedOperationException();
127 }
128
129
130 @Override
131 public short readShort() throws IOException {
132 throw new UnsupportedOperationException();
133 }
134
135
136 @Override
137 public int readUnsignedShort() throws IOException {
138 throw new UnsupportedOperationException();
139 }
140
141
142 @Override
143 public char readChar() throws IOException {
144 throw new UnsupportedOperationException();
145 }
146
147
148 @Override
149 public float readFloat() throws IOException {
150 throw new UnsupportedOperationException();
151 }
152
153
154 @Override
155 public double readDouble() throws IOException {
156 throw new UnsupportedOperationException();
157 }
158
159
160 @Override
161 public String readLine() throws IOException {
162 throw new UnsupportedOperationException();
163 }
164
165
166 @Override
167 public String readUTF() throws IOException {
168 throw new UnsupportedOperationException();
169 }
170 }