PageRenderTime 32ms CodeModel.GetById 15ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 1ms

/hazelcast/src/main/java/com/hazelcast/nio/DefaultSocketChannelWrapper.java

https://bitbucket.org/gabral6_gmailcom/hazelcast
Java | 103 lines | 66 code | 22 blank | 15 comment | 0 complexity | 77324eb280a5294f7c5db5a9bc7c4e87 MD5 | raw file
  1/*
  2 * Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved.
  3 *
  4 * Licensed under the Apache License, Version 2.0 (the "License");
  5 * you may not use this file except in compliance with the License.
  6 * You may obtain a copy of the License at
  7 *
  8 * http://www.apache.org/licenses/LICENSE-2.0
  9 *
 10 * Unless required by applicable law or agreed to in writing, software
 11 * distributed under the License is distributed on an "AS IS" BASIS,
 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13 * See the License for the specific language governing permissions and
 14 * limitations under the License.
 15 */
 16
 17package com.hazelcast.nio;
 18
 19import java.io.IOException;
 20import java.net.Socket;
 21import java.net.SocketAddress;
 22import java.nio.ByteBuffer;
 23import java.nio.channels.*;
 24
 25public class DefaultSocketChannelWrapper implements SocketChannelWrapper {
 26    protected final SocketChannel socketChannel;
 27
 28    public DefaultSocketChannelWrapper(SocketChannel socketChannel) {
 29        this.socketChannel = socketChannel;
 30    }
 31
 32    public boolean isBlocking() {
 33        return socketChannel.isBlocking();
 34    }
 35
 36    public int validOps() {
 37        return socketChannel.validOps();
 38    }
 39
 40    public Socket socket() {
 41        return socketChannel.socket();
 42    }
 43
 44    public boolean isConnected() {
 45        return socketChannel.isConnected();
 46    }
 47
 48    public boolean isConnectionPending() {
 49        return socketChannel.isConnectionPending();
 50    }
 51
 52    public boolean connect(SocketAddress socketAddress) throws IOException {
 53        return socketChannel.connect(socketAddress);
 54    }
 55
 56    public boolean finishConnect() throws IOException {
 57        return socketChannel.finishConnect();
 58    }
 59
 60    public int read(ByteBuffer byteBuffer) throws IOException {
 61        return socketChannel.read(byteBuffer);
 62    }
 63
 64    public long read(ByteBuffer[] byteBuffers, int i, int i1) throws IOException {
 65        return socketChannel.read(byteBuffers, i, i1);
 66    }
 67
 68    public long read(ByteBuffer[] byteBuffers) throws IOException {
 69        return socketChannel.read(byteBuffers);
 70    }
 71
 72    public int write(ByteBuffer byteBuffer) throws IOException {
 73        return socketChannel.write(byteBuffer);
 74    }
 75
 76    public long write(ByteBuffer[] byteBuffers, int i, int i1) throws IOException {
 77        return socketChannel.write(byteBuffers, i, i1);
 78    }
 79
 80    public long write(ByteBuffer[] byteBuffers) throws IOException {
 81        return socketChannel.write(byteBuffers);
 82    }
 83
 84    public SelectableChannel configureBlocking(boolean b) throws IOException {
 85        return socketChannel.configureBlocking(b);
 86    }
 87
 88    public boolean isOpen() {
 89        return socketChannel.isOpen();
 90    }
 91
 92    public void close() throws IOException {
 93        socketChannel.close();
 94    }
 95
 96    public SelectionKey keyFor(Selector selector) {
 97        return socketChannel.keyFor(selector);
 98    }
 99
100    public SelectionKey register(Selector selector, int i, Object o) throws ClosedChannelException {
101        return socketChannel.register(selector, i, o);
102    }
103}