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 protected AbstractRandomAccessStreamContent(final RandomAccessMode mode) {
31 super(mode);
32 }
33
34 protected abstract DataInputStream getDataInputStream() throws IOException;
35
36 @Override
37 public byte readByte() throws IOException {
38 return getDataInputStream().readByte();
39 }
40
41 @Override
42 public char readChar() throws IOException {
43 return getDataInputStream().readChar();
44 }
45
46 @Override
47 public double readDouble() throws IOException {
48 return getDataInputStream().readDouble();
49 }
50
51 @Override
52 public float readFloat() throws IOException {
53 return getDataInputStream().readFloat();
54 }
55
56 @Override
57 public int readInt() throws IOException {
58 return getDataInputStream().readInt();
59 }
60
61 @Override
62 public int readUnsignedByte() throws IOException {
63 return getDataInputStream().readUnsignedByte();
64 }
65
66 @Override
67 public int readUnsignedShort() throws IOException {
68 return getDataInputStream().readUnsignedShort();
69 }
70
71 @Override
72 public long readLong() throws IOException {
73 return getDataInputStream().readLong();
74 }
75
76 @Override
77 public short readShort() throws IOException {
78 return getDataInputStream().readShort();
79 }
80
81 @Override
82 public boolean readBoolean() throws IOException {
83 return getDataInputStream().readBoolean();
84 }
85
86 @Override
87 public int skipBytes(final int n) throws IOException {
88 return getDataInputStream().skipBytes(n);
89 }
90
91 @Override
92 public void readFully(final byte[] b) throws IOException {
93 getDataInputStream().readFully(b);
94 }
95
96 @Override
97 public void readFully(final byte[] b, final int off, final int len) throws IOException {
98 getDataInputStream().readFully(b, off, len);
99 }
100
101 @Override
102 public String readUTF() throws IOException {
103 return getDataInputStream().readUTF();
104 }
105
106 @Override
107 public InputStream getInputStream() throws IOException {
108 return getDataInputStream();
109 }
110
111 @Override
112 public void setLength(final long newLength) throws IOException {
113 throw new UnsupportedOperationException();
114 }
115 }