| | |
| | | |
| | | |
| | | private final ByteChannel child; |
| | | |
| | | private volatile ByteChannel redirect = null; |
| | | |
| | | |
| | |
| | | */ |
| | | public void close() throws IOException |
| | | { |
| | | if (redirect != null) |
| | | final ByteChannel tmp = redirect; |
| | | if (tmp != null) |
| | | { |
| | | redirect.close(); |
| | | tmp.close(); |
| | | } |
| | | else |
| | | { |
| | |
| | | */ |
| | | public boolean isOpen() |
| | | { |
| | | if (redirect != null) |
| | | final ByteChannel tmp = redirect; |
| | | if (tmp != null) |
| | | { |
| | | return redirect.isOpen(); |
| | | return tmp.isOpen(); |
| | | } |
| | | return child.isOpen(); |
| | | else |
| | | { |
| | | return child.isOpen(); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | public int read(final ByteBuffer buffer) throws IOException |
| | | { |
| | | if (redirect != null) |
| | | final ByteChannel tmp = redirect; |
| | | if (tmp != null) |
| | | { |
| | | return redirect.read(buffer); |
| | | return tmp.read(buffer); |
| | | } |
| | | else |
| | | { |
| | |
| | | */ |
| | | public int write(final ByteBuffer buffer) throws IOException |
| | | { |
| | | if (redirect != null) |
| | | final ByteChannel tmp = redirect; |
| | | if (tmp != null) |
| | | { |
| | | return redirect.write(buffer); |
| | | return tmp.write(buffer); |
| | | } |
| | | else |
| | | { |