1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.io.channels;
19
20 import java.io.IOException;
21 import java.nio.ByteBuffer;
22 import java.nio.MappedByteBuffer;
23 import java.nio.channels.FileChannel;
24 import java.nio.channels.FileLock;
25 import java.nio.channels.ReadableByteChannel;
26 import java.nio.channels.WritableByteChannel;
27
28
29
30
31 class FileChannelProxy extends FileChannel {
32
33 FileChannel fileChannel;
34
35 FileChannelProxy(final FileChannel fileChannel) {
36 this.fileChannel = fileChannel;
37 }
38
39 @Override
40 public boolean equals(final Object o) {
41 return fileChannel.equals(o);
42 }
43
44 @Override
45 public void force(final boolean metaData) throws IOException {
46 fileChannel.force(metaData);
47 }
48
49 @Override
50 public int hashCode() {
51 return fileChannel.hashCode();
52 }
53
54 @Override
55 protected void implCloseChannel() throws IOException {
56 fileChannel.close();
57 }
58
59 @Override
60 public FileLock lock(final long position, final long size, final boolean shared) throws IOException {
61 return fileChannel.lock(position, size, shared);
62 }
63
64 @Override
65 public MappedByteBuffer map(final MapMode mode, final long position, final long size) throws IOException {
66 return fileChannel.map(mode, position, size);
67 }
68
69 @Override
70 public long position() throws IOException {
71 return fileChannel.position();
72 }
73
74 @Override
75 public FileChannel position(final long newPosition) throws IOException {
76 return fileChannel.position(newPosition);
77 }
78
79 @Override
80 public int read(final ByteBuffer dst) throws IOException {
81 return fileChannel.read(dst);
82 }
83
84 @Override
85 public int read(final ByteBuffer dst, final long position) throws IOException {
86 return fileChannel.read(dst, position);
87 }
88
89 @Override
90 public long read(final ByteBuffer[] dsts, final int offset, final int length) throws IOException {
91 return fileChannel.read(dsts, offset, length);
92 }
93
94 @Override
95 public long size() throws IOException {
96 return fileChannel.size();
97 }
98
99 @Override
100 public String toString() {
101 return fileChannel.toString();
102 }
103
104 @Override
105 public long transferFrom(final ReadableByteChannel src, final long position, final long count) throws IOException {
106 return fileChannel.transferFrom(src, position, count);
107 }
108
109 @Override
110 public long transferTo(final long position, final long count, final WritableByteChannel target) throws IOException {
111 return fileChannel.transferTo(position, count, target);
112 }
113
114 @Override
115 public FileChannel truncate(final long size) throws IOException {
116 return fileChannel.truncate(size);
117 }
118
119 @Override
120 public FileLock tryLock(final long position, final long size, final boolean shared) throws IOException {
121 return fileChannel.tryLock(position, size, shared);
122 }
123
124 @Override
125 public int write(final ByteBuffer src) throws IOException {
126 return fileChannel.write(src);
127 }
128
129 @Override
130 public int write(final ByteBuffer src, final long position) throws IOException {
131 return fileChannel.write(src, position);
132 }
133
134 @Override
135 public long write(final ByteBuffer[] srcs, final int offset, final int length) throws IOException {
136 return fileChannel.write(srcs, offset, length);
137 }
138 }