

package gov.va.med.cds.client.proxy;


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.SocketChannel;
import java.nio.channels.WritableByteChannel;


public class GetReadWriteChannel
{

    public ReadableByteChannel getReadChannel( SocketChannel socketChannel )
        throws IOException
    {
        InputStream inStream = socketChannel.socket().getInputStream();

        ReadableByteChannel wrappedReadableByteChannel = Channels.newChannel( inStream );

        return wrappedReadableByteChannel;
    }


    public WritableByteChannel getWriteChannel( SocketChannel socketChannel )
        throws IOException
    {
        OutputStream outputStream = socketChannel.socket().getOutputStream();

        WritableByteChannel wrappedWritableByteChannel = Channels.newChannel( outputStream );

        return wrappedWritableByteChannel;
    }
}