Package java.nio.channels

Examples of java.nio.channels.Pipe$SinkChannel


 
  @Test
  public void testSocketIOWithTimeout() throws Exception {
   
    // first open pipe:
    Pipe pipe = Pipe.open();
    Pipe.SourceChannel source = pipe.source();
    Pipe.SinkChannel sink = pipe.sink();
   
    try {
      final InputStream in = new SocketInputStream(source, TIMEOUT);
      OutputStream out = new SocketOutputStream(sink, TIMEOUT);
     
View Full Code Here


    public void test_read_$LByteBufferII() throws IOException {
        ByteBuffer[] bufArray = { buffer, positionedBuffer };
        boolean[] sinkBlockingMode = { true, true, false, false };
        boolean[] sourceBlockingMode = { true, false, true, false };
        for (int i = 0; i < sinkBlockingMode.length; ++i) {
            Pipe pipe = Pipe.open();
            sink = pipe.sink();
            source = pipe.source();

            sink.configureBlocking(sinkBlockingMode[i]);
            source.configureBlocking(sourceBlockingMode[i]);

            buffer.position(0);
View Full Code Here

    private int[] writableFDsToKeys;

    public SelectorImpl(SelectorProvider selectorProvider) {
        super(selectorProvider);
        try {
            Pipe mockSelector = selectorProvider.openPipe();
            sink = mockSelector.sink();
            source = mockSelector.source();
            sourcefd = ((FileDescriptorHandler) source).getFD();
            source.configureBlocking(false);

            readableFDs = new FileDescriptor[1];
            writableFDs = new FileDescriptor[0];
View Full Code Here

 
  /**
   * @tests java.nio.channels.Pipe#open()
   */
  public void test_open() throws IOException{
    Pipe pipe = Pipe.open();
    assertNotNull(pipe);
  }
View Full Code Here

 
  /**
   * @tests java.nio.channels.Pipe#sink()
   */
  public void test_sink() throws IOException {
    Pipe pipe = Pipe.open();
    SinkChannel sink = pipe.sink();
    assertTrue(sink.isBlocking());
  }
View Full Code Here

  /**
   * @tests java.nio.channels.Pipe#source()
   */
  public void test_source() throws IOException {
    Pipe pipe = Pipe.open();
    SourceChannel source = pipe.source();
    assertTrue(source.isBlocking());
  }
View Full Code Here

    private int[] writableFDsToKeys;

    public SelectorImpl(SelectorProvider selectorProvider) {
        super(selectorProvider);
        try {
            Pipe mockSelector = selectorProvider.openPipe();
            sink = mockSelector.sink();
            source = mockSelector.source();
            sourcefd = ((FileDescriptorHandler) source).getFD();
            source.configureBlocking(false);

            readableFDs = new FileDescriptor[1];
            writableFDs = new FileDescriptor[0];
View Full Code Here

  }
 
  public void testSocketIOWithTimeout() throws IOException {
   
    // first open pipe:
    Pipe pipe = Pipe.open();
    Pipe.SourceChannel source = pipe.source();
    Pipe.SinkChannel sink = pipe.sink();
   
    try {
      InputStream in = new SocketInputStream(source, TIMEOUT);
      OutputStream out = new SocketOutputStream(sink, TIMEOUT);
     
View Full Code Here

    private InternalKeyMap<EpollSelectionKeyImpl> quickMap = new InternalKeyMap<EpollSelectionKeyImpl>();

    public EpollSelectorImpl(SelectorProvider selectorProvider) {
        super(selectorProvider);
        try {
            Pipe mockSelector = selectorProvider.openPipe();
            sink = mockSelector.sink();
            source = mockSelector.source();
            sourcefd = ((FileDescriptorHandler) source).getFD();
            source.configureBlocking(false);

            fileDescriptorClass = sourcefd.getClass();
View Full Code Here

  // REMIND: create threads and other resources lazily?

  selector = Selector.open();

  Pipe pipe = Pipe.open();
  wakeupPipeSink = pipe.sink();
  wakeupPipeSource = pipe.source();
  wakeupPipeSource.configureBlocking(false);
  wakeupPipeKey = wakeupPipeSource.register(selector,
              SelectionKey.OP_READ);

  for (int i = 0; i < concurrency; i++) {
View Full Code Here

TOP

Related Classes of java.nio.channels.Pipe$SinkChannel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.