Examples of ChannelInputStream


Examples of de.netseeker.ejoe.io.ChannelInputStream

    private Object readBlocked( SerializeAdapter adapter ) throws Exception
    {
        // usual way: deserialize using a adapter
        if ( !this._senderInfo.isDirect() )
        {
            return deserialize( adapter, new ChannelInputStream( Channels
                    .newInputStream( this._senderInfo.getChannel() ) ) );
        }
        // direct mode: don't deserialize, just copy and return the read
        // ByteBuffer
        else
        {
            return IOUtil
                    .readDirect( new ChannelInputStream( Channels.newInputStream( this._senderInfo.getChannel() ) ) );
        }
    }
View Full Code Here

Examples of de.netseeker.ejoe.io.ChannelInputStream

        {
            serialize( Channels.newOutputStream( _channel ), obj, clientInfo );
            // default mode: deserialize the server response
            if ( !clientInfo.isMixed() )
            {
                result = deserialize( new ChannelInputStream( Channels.newInputStream( _channel ) ), clientInfo );
            }
            // mixed mode: don't deserialize the server response
            else
            {
                result = IOUtil.readDirect( new ChannelInputStream( Channels.newInputStream( _channel ) ) );
            }
        }
        // direct mode: don't (de)serialize, just copy and return the read
        // ByteBuffer
        else
        {
            ByteBuffer tmp = (ByteBuffer) obj;
            if ( tmp.position() > 0 )
            {
                tmp.flip();
            }
            IOUtil.writeDirect( Channels.newOutputStream( _channel ), tmp );
            result = IOUtil.readDirect( new ChannelInputStream( Channels.newInputStream( _channel ) ) );
        }

        return result;
    }
View Full Code Here

Examples of gnu.java.nio.ChannelInputStream

     */
    static InputStream newInputStream(ReadableByteChannel ch) {
        if (ch instanceof FileChannelImpl)
            return (FileInputStream) createStream(FileInputStream.class, ch);

        return new ChannelInputStream(ch);
    }
View Full Code Here

Examples of gnu.java.nio.ChannelInputStream

static InputStream newInputStream(ReadableByteChannel ch)
{
  if (ch instanceof FileChannelImpl)
   return VMAccessorJavaIo.newFileInputStream((FileChannelImpl) ch);
  return new ChannelInputStream(ch);
}
View Full Code Here

Examples of org.jnode.util.ChannelInputStream

            w.print("This is a second line of text!\r\n");
            w.print("Just for fun, a third line!\r\n");
            w.flush();

            System.out.println("Now waiting for one incoming line of text.");
            Reader r = new InputStreamReader(new ChannelInputStream(channel));
            while (true) {
                int c = r.read();
                if (c >= 32) System.out.write(c);
                if (c == '\n') break;
            }
View Full Code Here

Examples of org.xnio.streams.ChannelInputStream

        final CountDownLatch latch = new CountDownLatch(1);
        final AtomicReference<String> result = new AtomicReference<String>();
        webSocketChannel.getReceiveSetter().set(new ChannelListener<WebSocketChannel>() {
            @Override
            public void handleEvent(final WebSocketChannel channel) {
                ChannelInputStream stream = null;
                try {
                    final StreamSourceFrameChannel r = channel.receive();
                    if (r != null) {
                        stream = new ChannelInputStream(r);
                        result.set(FileUtils.readFile(stream));
                        latch.countDown();
                    }
                } catch (IOException e) {
                    e.printStackTrace();
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.