1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.vfs2.provider;
18
19 import java.io.DataInputStream;
20 import java.io.IOException;
21 import java.io.InputStream;
22
23 import org.apache.commons.vfs2.util.RandomAccessMode;
24
25
26
27
28 public abstract class AbstractRandomAccessStreamContent extends AbstractRandomAccessContent {
29
30
31
32
33
34
35 protected AbstractRandomAccessStreamContent(final RandomAccessMode mode) {
36 super(mode);
37 }
38
39
40
41
42
43
44
45 protected abstract DataInputStream getDataInputStream() throws IOException;
46
47 @Override
48 public InputStream getInputStream() throws IOException {
49 return getDataInputStream();
50 }
51
52 @Override
53 public boolean readBoolean() throws IOException {
54 return getDataInputStream().readBoolean();
55 }
56
57 @Override
58 public byte readByte() throws IOException {
59 return getDataInputStream().readByte();
60 }
61
62 @Override
63 public char readChar() throws IOException {
64 return getDataInputStream().readChar();
65 }
66
67 @Override
68 public double readDouble() throws IOException {
69 return getDataInputStream().readDouble();
70 }
71
72 @Override
73 public float readFloat() throws IOException {
74 return getDataInputStream().readFloat();
75 }
76
77 @Override
78 public void readFully(final byte[] b) throws IOException {
79 getDataInputStream().readFully(b);
80 }
81
82 @Override
83 public void readFully(final byte[] b, final int off, final int len) throws IOException {
84 getDataInputStream().readFully(b, off, len);
85 }
86
87 @Override
88 public int readInt() throws IOException {
89 return getDataInputStream().readInt();
90 }
91
92 @Override
93 public long readLong() throws IOException {
94 return getDataInputStream().readLong();
95 }
96
97 @Override
98 public short readShort() throws IOException {
99 return getDataInputStream().readShort();
100 }
101
102 @Override
103 public int readUnsignedByte() throws IOException {
104 return getDataInputStream().readUnsignedByte();
105 }
106
107 @Override
108 public int readUnsignedShort() throws IOException {
109 return getDataInputStream().readUnsignedShort();
110 }
111
112 @Override
113 public String readUTF() throws IOException {
114 return getDataInputStream().readUTF();
115 }
116
117 @Override
118 public void setLength(final long newLength) throws IOException {
119 throw new UnsupportedOperationException();
120 }
121
122 @Override
123 public int skipBytes(final int n) throws IOException {
124 return getDataInputStream().skipBytes(n);
125 }
126 }