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