Examples of ByteBufferInputStream


Examples of org.apache.zookeeper.server.ByteBufferInputStream

            eventThread.queueEvent(new WatchedEvent(Watcher.Event.EventType.None,
                    Watcher.Event.KeeperState.SyncConnected, null));
        }

        void readResponse() throws IOException {
            ByteBufferInputStream bbis = new ByteBufferInputStream(
                    incomingBuffer);
            BinaryInputArchive bbia = BinaryInputArchive.getArchive(bbis);
            ReplyHeader replyHdr = new ReplyHeader();

            replyHdr.deserialize(bbia, "header");
View Full Code Here

Examples of org.apache.zookeeper.server.ByteBufferInputStream

            }
            incomingBuffer = ByteBuffer.allocate(len);
        }

        void readConnectResult() throws IOException {
            ByteBufferInputStream bbis = new ByteBufferInputStream(
                    incomingBuffer);
            BinaryInputArchive bbia = BinaryInputArchive.getArchive(bbis);
            ConnectResponse conRsp = new ConnectResponse();
            conRsp.deserialize(bbia, "connect");
            int sessionTimeout = conRsp.getTimeOut();
View Full Code Here

Examples of org.apache.zookeeper.server.ByteBufferInputStream

            eventThread.queueEvent(new WatchedEvent(Watcher.Event.EventType.None,
                    Watcher.Event.KeeperState.SyncConnected, null));
        }

        void readResponse() throws IOException {
            ByteBufferInputStream bbis = new ByteBufferInputStream(
                    incomingBuffer);
            BinaryInputArchive bbia = BinaryInputArchive.getArchive(bbis);
            ReplyHeader replyHdr = new ReplyHeader();

            replyHdr.deserialize(bbia, "header");
View Full Code Here

Examples of org.apache.zookeeper.server.ByteBufferInputStream

            }
            incomingBuffer = ByteBuffer.allocate(len);
        }

        void readConnectResult() throws IOException {
            ByteBufferInputStream bbis = new ByteBufferInputStream(
                    incomingBuffer);
            BinaryInputArchive bbia = BinaryInputArchive.getArchive(bbis);
            ConnectResponse conRsp = new ConnectResponse();
            conRsp.deserialize(bbia, "connect");
            negotiatedSessionTimeout = conRsp.getTimeOut();
View Full Code Here

Examples of org.apache.zookeeper.server.ByteBufferInputStream

            eventThread.queueEvent(new WatchedEvent(Watcher.Event.EventType.None,
                    Watcher.Event.KeeperState.SyncConnected, null));
        }

        void readResponse() throws IOException {
            ByteBufferInputStream bbis = new ByteBufferInputStream(
                    incomingBuffer);
            BinaryInputArchive bbia = BinaryInputArchive.getArchive(bbis);
            ReplyHeader replyHdr = new ReplyHeader();

            replyHdr.deserialize(bbia, "header");
View Full Code Here

Examples of org.apache.zookeeper_voltpatches.server.ByteBufferInputStream

            }
            incomingBuffer = ByteBuffer.allocate(len);
        }

        void readConnectResult() throws IOException {
            ByteBufferInputStream bbis = new ByteBufferInputStream(
                    incomingBuffer);
            BinaryInputArchive bbia = BinaryInputArchive.getArchive(bbis);
            ConnectResponse conRsp = new ConnectResponse();
            conRsp.deserialize(bbia, "connect");
            negotiatedSessionTimeout = conRsp.getTimeOut();
View Full Code Here

Examples of org.commonlib.io.ByteBufferInputStream

   * @throws Exception
   */
  public static Serializable readObjectFromBytes(byte[] array)
     throws Exception
  {
    ByteBufferInputStream fis = new ByteBufferInputStream();
    fis.addToBuffer(array);
    ObjectInputStream ois = new ObjectInputStream(fis);
    Object or = null;
    try
    {
      or = ois.readObject();
    }
    finally
    {
      ois.close();
      fis.close();
    }
    return (Serializable) or;
  }
View Full Code Here

Examples of org.exist.util.io.ByteBufferInputStream

        channel.close();
    }

    @Override
    public InputStream getInputStream() {
        return new ByteBufferInputStream(new ByteBufferAccessor() {

            private ByteBuffer roBuf;

            @Override
            public ByteBuffer getBuffer() {
View Full Code Here

Examples of org.glassfish.jersey.internal.util.collection.ByteBufferInputStream

                        jettyRequest.abort(t);
                    }
                }
            });
            final AtomicReference<ClientResponse> jerseyResponse = new AtomicReference<ClientResponse>();
            final ByteBufferInputStream entityStream = new ByteBufferInputStream();
            jettyRequest.send(new Response.Listener.Adapter() {

                @Override
                public void onHeaders(final Response jettyResponse) {
                    HeaderUtils.checkHeaderChanges(clientHeadersSnapshot, jerseyRequest.getHeaders(),
                            JettyConnector.this.getClass().getName());

                    if (responseFuture.isDone())
                        if (!callbackInvoked.compareAndSet(false, true)) {
                            return;
                        }
                    final ClientResponse response = translateResponse(jerseyRequest, jettyResponse, entityStream);
                    jerseyResponse.set(response);
                    callback.response(response);
                }

                @Override
                public void onContent(final Response jettyResponse, final ByteBuffer content) {
                    try {
                        entityStream.put(content);
                    } catch (final InterruptedException ex) {
                        final ProcessingException pe = new ProcessingException(ex);
                        entityStream.closeQueue(pe);
                        // try to complete the future with an exception
                        responseFuture.setException(pe);
                        Thread.currentThread().interrupt();
                    }
                }

                @Override
                public void onComplete(final Result result) {
                    entityStream.closeQueue();
                    // try to complete the future with the response only once truly done
                    responseFuture.set(jerseyResponse.get());
                }

                @Override
                public void onFailure(final Response response, final Throwable t) {
                    entityStream.closeQueue(t);
                    // try to complete the future with an exception
                    responseFuture.setException(t);
                    if (callbackInvoked.compareAndSet(false, true)) {
                        callback.failure(t);
                    }
View Full Code Here

Examples of org.jgroups.util.ByteBufferInputStream

        msg.writeTo(out);

        buf.flip();
        byte[] array=new byte[buf.limit()];
        System.arraycopy(buf.array(), buf.arrayOffset(), array, 0, buf.limit());
        ByteBufferInputStream in=new ByteBufferInputStream(ByteBuffer.wrap(array));
        Message copy=new Message(false);
        copy.readFrom(in);
        System.out.println("copy = " + copy);
        assert msg.getDest() != null && msg.getDest().equals(dest);
    }
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.