Examples of sink()


Examples of java.nio.channels.Pipe.sink()

        try {
            Pipe pipe = Pipe.open();

            RubyIO source = new RubyIO(runtime, pipe.source());
            source.setEncodingFromOptions(EncodingOption.getEncodingOptionFromString(runtime, modes.toString()));
            RubyIO sink = new RubyIO(runtime, pipe.sink());

//            Encoding ascii8bit = context.runtime.getEncodingService().getAscii8bitEncoding();
//            sink.setupReadWriteEncodings(context, ascii8bit, ascii8bit);

            sink.openFile.getMainStreamSafe().setSync(true);
View Full Code Here

Examples of java.nio.channels.Pipe.sink()

    public PipeImpl() throws IOException {
        if (useNative) {
            Pipe pipe = Pipe.open();
            source = pipe.source();
            sink = pipe.sink();

        } else {
            PipedInputStream pipedIn = new PipedInputStream();
            try {
                pipedOut = new PipedOutputStream(pipedIn);
View Full Code Here

Examples of java.nio.channels.Pipe.sink()

            @Override
            public void run() {

                try {
                    info.writeTo(pipe.sink());
                }
                catch (IOException e) {
                    e.printStackTrace();
                }
            }
View Full Code Here

Examples of java.nio.channels.Pipe.sink()

            @Override
            public void run() {

                try {
                    PARAMS.writeTo(pipe.sink());
                }
                catch (IOException e) {
                    e.printStackTrace();
                }
            }
View Full Code Here

Examples of java.nio.channels.Pipe.sink()

  // 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);
View Full Code Here

Examples of java.nio.channels.Pipe.sink()

    final Pipe pipe = Pipe.open();
    final ConversionTask task = new ConversionTask();
    task.setConverter(this.c1);
    task.setIn(in);
    task.setOut(Channels.newOutputStream(pipe.sink()));
    task.setParams(params1);
    final ExecutorService taskPool = Executors.newSingleThreadExecutor();
    final Future<Exception> f = taskPool.submit(task);
    taskPool.shutdown();
    Exception e1 = null;
View Full Code Here

Examples of java.nio.channels.Pipe.sink()

    public SelectorImpl(SelectorProvider selectorProvider) {
        super(selectorProvider);
        try {
            Pipe mockSelector = selectorProvider.openPipe();
            sink = mockSelector.sink();
            source = mockSelector.source();
            sourcefd = ((FileDescriptorHandler)source).getFD();
            source.configureBlocking(false);
        } catch (IOException e) {
            // do nothing
View Full Code Here

Examples of java.nio.channels.Pipe.sink()

    public SelectorImpl(SelectorProvider selectorProvider) {
        super(selectorProvider);
        try {
            Pipe mockSelector = selectorProvider.openPipe();
            sink = mockSelector.sink();
            source = mockSelector.source();
            sourcefd = ((FileDescriptorHandler)source).getFD();
            source.configureBlocking(false);
        } catch (IOException e) {
            // do nothing
View Full Code Here

Examples of java.nio.channels.Pipe.sink()

    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];
View Full Code Here

Examples of java.nio.channels.Pipe.sink()

  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
TOP
Copyright © 2018 www.massapi.com. 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.