Example usage for org.apache.hadoop.net NetUtils getOutputStream

List of usage examples for org.apache.hadoop.net NetUtils getOutputStream

Introduction

In this page you can find the example usage for org.apache.hadoop.net NetUtils getOutputStream.

Prototype

public static OutputStream getOutputStream(Socket socket, long timeout) throws IOException 

Source Link

Document

Returns OutputStream for the socket.

Usage

From source file:org.apache.accumulo.core.rpc.TTimeoutTransport.java

License:Apache License

protected OutputStream wrapOutputStream(Socket socket, long timeoutMillis) throws IOException {
    return new BufferedOutputStream(NetUtils.getOutputStream(socket, timeoutMillis), 1024 * 10);
}

From source file:org.apache.accumulo.core.util.TTimeoutTransport.java

License:Apache License

public static TTransport create(SocketAddress addr, long timeoutMillis) throws IOException {
    Socket socket = SelectorProvider.provider().openSocketChannel().socket();
    socket.setSoLinger(false, 0);//from www. j a v  a2s . c om
    socket.setTcpNoDelay(true);
    socket.connect(addr);
    InputStream input = new BufferedInputStream(getInputStream(socket, timeoutMillis), 1024 * 10);
    OutputStream output = new BufferedOutputStream(NetUtils.getOutputStream(socket, timeoutMillis), 1024 * 10);
    return new TIOStreamTransport(input, output);
}