Package org.ajax4jsf.io

Examples of org.ajax4jsf.io.ByteBuffer


            stream.write(i);
        }

        assertEquals(255, stream.getLength());

        ByteBuffer firstBuffer = stream.getFirstBuffer();

        assertNull(firstBuffer.getNext());
        assertNull(firstBuffer.getPrevious());
        stream.reset();
        assertEquals(0, stream.getLength());
        firstBuffer = stream.getFirstBuffer();
        assertEquals(0, firstBuffer.getUsedSize());
        assertNull(firstBuffer.getNext());
        assertNull(firstBuffer.getPrevious());
    }
View Full Code Here


            stream.write(i);
        }

        assertEquals(257, stream.getLength());

        ByteBuffer firstBuffer = stream.getFirstBuffer();

        assertNotNull(firstBuffer.getNext());
        assertNull(firstBuffer.getPrevious());
        stream.reset();
        assertEquals(0, stream.getLength());
        firstBuffer = stream.getFirstBuffer();
        assertEquals(0, firstBuffer.getUsedSize());
        assertNull(firstBuffer.getNext());
        assertNull(firstBuffer.getPrevious());
    }
View Full Code Here

        public InputStream getWrittenDataAsStream() throws IOException {
            flushBuffers();

            if (stream != null) {
                ByteBuffer firstBuffer = stream.getFirstBuffer();
                firstBuffer.compact();
                return new FastBufferInputStream(firstBuffer);
            } else {
                return EMPTY_STREAM;
            }
        }
View Full Code Here

                } catch (IOException e) {
                    // Swallow
                }
            }
        }
        ByteBuffer buffer = fbos.getFirstBuffer();
        buffer.compact();

        return new FastBufferInputStream(buffer);
    }
View Full Code Here

                    LOGGER.debug(e.getMessage(), e);
                }
            }
        }

        ByteBuffer buffer = os.getFirstBuffer();

        buffer.compact();

        return buffer;
    }
View Full Code Here

    private byte[] getBufferBytes() {
        byte[] bs = new byte[buffer.getLast().getTotalSize()];

        int pos = 0;
        ByteBuffer currentBuffer = buffer;
        while (currentBuffer != null) {
            System.arraycopy(currentBuffer.getBytes(), 0, bs, pos, currentBuffer.getUsedSize());
            pos += currentBuffer.getUsedSize();
            currentBuffer = currentBuffer.getNext();
        }

        return bs;
    }
View Full Code Here

    public void handle(byte[] bytes, int length) throws IOException {
        buffer.append(bytes, 0, length);
    }

    public void create() throws IOException {
        buffer = new ByteBuffer(256);
    }
View Full Code Here

    public void handle(byte[] bytes, int length) throws IOException {
        buffer.append(bytes, 0, length);
    }

    public void create() {
        buffer = new ByteBuffer(128);
    }
View Full Code Here

    for (int i = 0; i < 255; i++) {
      stream.write(i);
    }
   
    assertEquals(255, stream.getLength());
    ByteBuffer firstBuffer = stream.getFirstBuffer();
    assertNull(firstBuffer.getNext());
    assertNull(firstBuffer.getPrevious());

    stream.reset();
   
    assertEquals(0, stream.getLength());
    firstBuffer = stream.getFirstBuffer();
    assertEquals(0, firstBuffer.getUsedSize());
    assertNull(firstBuffer.getNext());
    assertNull(firstBuffer.getPrevious());
  }
View Full Code Here

    for (int i = 0; i < 257; i++) {
      stream.write(i);
    }

    assertEquals(257, stream.getLength());
    ByteBuffer firstBuffer = stream.getFirstBuffer();
    assertNotNull(firstBuffer.getNext());
    assertNull(firstBuffer.getPrevious());

    stream.reset();
   
    assertEquals(0, stream.getLength());
    firstBuffer = stream.getFirstBuffer();
    assertEquals(0, firstBuffer.getUsedSize());
    assertNull(firstBuffer.getNext());
    assertNull(firstBuffer.getPrevious());
  }
View Full Code Here

TOP

Related Classes of org.ajax4jsf.io.ByteBuffer

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.