Examples of Buffer


Examples of org.apache.commons.collections.Buffer

  public void doGet(HttpServletRequest request,
      HttpServletResponse response) throws
    ServletException, IOException {
    StringBuffer sb = new StringBuffer();

    Buffer nl = NotificationList.getInstance().getNotifications();
    Iterator it = nl.iterator();
    while (it.hasNext()) {
      String notification = (String) it.next();   
      sb.append(notification);
    }
    nl.clear();
    PrintWriter out = response.getWriter();
    out.println(sb.toString());
  }
View Full Code Here

Examples of org.apache.commons.collections15.Buffer

    /**
     * Tests {@link BlockingBuffer#get()} in combination with {@link BlockingBuffer#add()}.
     */
    public void testGetWithAdd() {

        Buffer blockingBuffer = BlockingBuffer.decorate(new MyBuffer());
        Object obj = new Object();

        new DelayedAdd(blockingBuffer, obj).start();

        // verify does not throw BufferUnderflowException; should block until other thread has added to the buffer .
        assertSame(obj, blockingBuffer.get());
    }
View Full Code Here

Examples of org.apache.flink.runtime.io.network.Buffer

    // 2. failure: buffer is available
    // --------------------------------------------------------------------
    registration = bufferPool.registerBufferAvailabilityListener(listener);
    Assert.assertEquals(BufferAvailabilityRegistration.FAILED_BUFFER_AVAILABLE, registration);

    Buffer buffer = bufferPool.requestBuffer(BUFFER_SIZE);
    Assert.assertNotNull(buffer);

    buffer.recycleBuffer();

    // --------------------------------------------------------------------
    // 3. failure: buffer pool destroyed
    // --------------------------------------------------------------------
    bufferPool.destroy();
View Full Code Here

Examples of org.apache.geronimo.gshell.ansi.Buffer

    }

    public String getWelcomeBanner() {
        StringWriter writer = new StringWriter();
        PrintWriter out = new RenderWriter(writer);
        Buffer buff = new Buffer();

        for (String line : BANNER) {
            buff.attrib(line, Code.CYAN);
            out.println(buff);
        }

        out.println();
        out.println(" @|bold ServiceMix| (" + getVersion() + ")");
View Full Code Here

Examples of org.apache.hadoop.record.Buffer

    list.add(123456789L);
    Map<Object, Object> map = new HashMap<Object, Object>();
    map.put("one", 1);
    map.put("vector", vector);
    Object[] objects = new Object[] {
      new Buffer(new byte[] { 1, 2, 3, 4 }),
      (byte) 123, true, 12345, 123456789L, (float) 1.2, 1.234,
      "random string", vector, list, map
    };
    byte[] appSpecificBytes = new byte[] { 1, 2, 3 };

    FileOutputStream ostream = new FileOutputStream(tmpfile);
    DataOutputStream dostream = new DataOutputStream(ostream);
    TypedBytesOutput out = new TypedBytesOutput(dostream);
    for (Object obj : objects) {
      out.write(obj);
    }
    out.writeBytes(appSpecificBytes, 100);
    dostream.close();
    ostream.close();

    FileInputStream istream = new FileInputStream(tmpfile);
    DataInputStream distream = new DataInputStream(istream);
    TypedBytesInput in = new TypedBytesInput(distream);
    for (Object obj : objects) {
      assertEquals(obj, in.read());
    }
    assertEquals(new Buffer(appSpecificBytes), in.read());
    distream.close();
    istream.close();

    istream = new FileInputStream(tmpfile);
    distream = new DataInputStream(istream);
    in = new TypedBytesInput(distream);
    for (Object obj : objects) {
      byte[] bytes = in.readRaw();
      ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
      DataInputStream dis = new DataInputStream(bais);
      assertEquals(obj, (new TypedBytesInput(dis)).read());
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      TypedBytesOutput tbout = new TypedBytesOutput(new DataOutputStream(baos));
      tbout.writeRaw(bytes);
      bais = new ByteArrayInputStream(bytes);
      dis = new DataInputStream(bais);
      assertEquals(obj, (new TypedBytesInput(dis)).read());
    }
    byte[] rawBytes = in.readRaw();
    assertEquals(new Buffer(appSpecificBytes),
      new Buffer(rawBytes, 5, rawBytes.length - 5));
    distream.close();
    istream.close();
  }
View Full Code Here

Examples of org.apache.sshd.common.util.Buffer

  // TODO: Remove BugFixChannelExec when the if (len < 0) sendEof() logic is in mina-sshd.
  @Override
  protected void pumpInputStream() {
    try {
      while (!closeFuture.isClosed()) {
        Buffer buffer = session.createBuffer(SshConstants.Message.SSH_MSG_CHANNEL_DATA, 0);
        buffer.putInt(recipient);
        int wpos1 = buffer.wpos(); // keep buffer position to write data length later
        buffer.putInt(0);
        int wpos2 = buffer.wpos(); // keep buffer position for data write
        buffer.wpos(wpos2 + remoteWindow.getPacketSize()); // Make room
        int len = securedRead(in, buffer.array(), wpos2, remoteWindow.getPacketSize()); // read data into buffer
        if (len > 0) {
          buffer.wpos(wpos1);
          buffer.putInt(len);
          buffer.wpos(wpos2 + len);
          remoteWindow.waitAndConsume(len);
          log.debug("Send SSH_MSG_CHANNEL_DATA on channel {}", id);
          session.writePacket(buffer);
        } else {
          // This is the bug fix we need!!
View Full Code Here

Examples of org.apache.yoko.orb.OCI.Buffer

        QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "char", CorbaConstants.NP_WSDL_CORBA);
        TypeCode objTypeCode = orb.get_primitive_tc(TCKind.tk_char);
        CorbaPrimitiveHandler obj = new CorbaPrimitiveHandler(objName, objIdlType, objTypeCode, null);
        CorbaStreamable streamable = new CorbaStreamable(obj, objName);
       
        Buffer buf = new Buffer();
        OutputStream oStream = new OutputStream(buf);
        oStream.write_char('c');
       
        InputStream iStream = oStream.create_input_stream();
        streamable._read(iStream);
View Full Code Here

Examples of org.arch.buffer.Buffer

    try
    {
      int t = BufferHelper.readVarInt(buffer);
      type = CompressorType.fromInt(t);
      int size = BufferHelper.readVarInt(buffer);
      Buffer content = buffer;
      byte[] raw = buffer.getRawBuffer();
     
      switch (type)
      {
        case QUICKLZ:
View Full Code Here

Examples of org.eclipse.jetty.io.Buffer

    return first;
    }
   
    public static void put(Field field, Buffer buffer, HeaderForm form, boolean merge)
    {
      Buffer name;
      switch (form)
    {
    case COMPACT:
      name = SipHeaders.getCompact(field.getName());
      break;
View Full Code Here

Examples of org.fusesource.hawtbuf.Buffer

            dataOut.write(data.getData(), data.getOffset(), data.getLength());
        }
    }

    protected Buffer tightUnmarshalBuffer(DataInput dataIn, BooleanStream bs) throws IOException {
        Buffer rc = null;
        if (bs.readBoolean()) {
            int size = dataIn.readInt();
            byte[] t = new byte[size];
            dataIn.readFully(t);
            return new Buffer(t, 0, size);
        }
        return rc;
    }
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.