Examples of appendEntry()


Examples of com.fasterxml.util.membuf.ChunkyBytesMemBuffer.appendEntry()

        // buffer will have similar limits
        final ChunkyBytesMemBuffer buffer = createBytesBuffers(aType, 10, 1, 4).createChunkyBuffer(1, 3);

        // append 5 segments
        for (int i = 5; i > 0; --i) {
            buffer.appendEntry(new byte[i]);
        }
        assertEquals(5, buffer.getEntryCount());
        assertEquals(15, buffer.getTotalPayloadLength());
        assertFalse(buffer.isEmpty());
View Full Code Here

Examples of com.fasterxml.util.membuf.ChunkyBytesMemBuffer.appendEntry()

    private void _testChunkySkipAndRead(SegType aType) throws Exception
    {
        final ChunkyBytesMemBuffer buffer = createBytesBuffers(aType, 10, 1, 4).createChunkyBuffer(1, 3);

        for (int i = 5; i > 0; --i) { // 5, 4, 3, 2, 1 segments
            buffer.appendEntry(new byte[i]);
        }
        assertEquals(5, buffer.getEntryCount());
        assertEquals(15, buffer.getTotalPayloadLength());
        assertFalse(buffer.isEmpty());
View Full Code Here

Examples of com.fasterxml.util.membuf.ChunkyBytesMemBuffer.appendEntry()

    // Test to verify that skip works across buffer boundaries
    private void _testChunkyLongerSkip(SegType aType) throws Exception
    {
        final ChunkyBytesMemBuffer buffer = createBytesBuffers(aType, 10, 1, 4).createChunkyBuffer(1, 3);
        // maximum: 29 data bytes, 1 for length
        buffer.appendEntry(new byte[29]);
        assertEquals(29, buffer.skipNextEntry());
        assertEquals(-1, buffer.skipNextEntry());
    }

    /*
 
View Full Code Here

Examples of com.fasterxml.util.membuf.ChunkyBytesMemBuffer.appendEntry()

       // 10 byte segments, max 4
       final ChunkyBytesMemBuffer buffer = createBytesBuffers(aType, 10, 1, 4).createChunkyBuffer(1, 4);

       // append 6 segments
       for (int i = 1; i <= 6; ++i) {
           buffer.appendEntry(buildBytesChunk(i));
       }
       assertEquals(6, buffer.getEntryCount());
       assertEquals(21, buffer.getTotalPayloadLength());
       assertFalse(buffer.isEmpty());
View Full Code Here

Examples of com.fasterxml.util.membuf.impl.ChunkyBytesMemBufferImpl.appendEntry()

        // min size 2, so will allocate 2 right away
        assertEquals(2, alloc.getBufferOwnedSegmentCount());
        assertEquals(0, alloc.getReusableSegmentCount());
       
        buffer.appendEntry(new byte[24]); // fills 1 buffer, part of second
        buffer.appendEntry(new byte[17]); // fills 2nd buffer, starts third

        assertEquals(3, alloc.getBufferOwnedSegmentCount());
        assertEquals(0, alloc.getReusableSegmentCount());
        assertEquals(3, buffer.getSegmentCount());
View Full Code Here

Examples of com.fasterxml.util.membuf.impl.ChunkyBytesMemBufferImpl.appendEntry()

        // min size 2, so will allocate 2 right away
        assertEquals(2, alloc.getBufferOwnedSegmentCount());
        assertEquals(0, alloc.getReusableSegmentCount());
       
        buffer.appendEntry(new byte[24]); // fills 1 buffer, part of second
        buffer.appendEntry(new byte[17]); // fills 2nd buffer, starts third

        assertEquals(3, alloc.getBufferOwnedSegmentCount());
        assertEquals(0, alloc.getReusableSegmentCount());
        assertEquals(3, buffer.getSegmentCount());
View Full Code Here

Examples of com.fasterxml.util.membuf.impl.ChunkyBytesMemBufferImpl.appendEntry()

        assertEquals(0, alloc.getBufferOwnedSegmentCount());
        assertEquals(3, alloc.getReusableSegmentCount());

        // Ok: reuse seems to work; but we should NOT be able to do anything else
        try {
            buffer.appendEntry(new byte[1]);
            fail("Should not be able to append things to closed Buffer");
        } catch (IllegalStateException e) {
            verifyException(e, "instance closed");
        }
View Full Code Here

Examples of fork.lib.bio.seq.FastaExporter.appendEntry()

    FastaExporter fe= new FastaExporter(out);
    Iterator<GenomicRegion> it= gb.iterator();
    while(it.hasNext()){
        GenomicRegion gr= it.next();
        String seq= get.getSequence(gr);
        fe.appendEntry(new FastaEntry(gr.toUCSCFormat(), seq));
        String cseq = NucleotideSequenceParser.parseSequence(seq).complementary().toString();
        DirectionalGenomicRegion cgr= new DirectionalGenomicRegion(gr.chr, '-', (int)gr.low, (int)gr.high);
        fe.appendEntry(new FastaEntry( cgr.toUCSCFormat(), cseq));
    }
    fe.close();
View Full Code Here

Examples of fork.lib.bio.seq.FastaExporter.appendEntry()

        GenomicRegion gr= it.next();
        String seq= get.getSequence(gr);
        fe.appendEntry(new FastaEntry(gr.toUCSCFormat(), seq));
        String cseq = NucleotideSequenceParser.parseSequence(seq).complementary().toString();
        DirectionalGenomicRegion cgr= new DirectionalGenomicRegion(gr.chr, '-', (int)gr.low, (int)gr.high);
        fe.appendEntry(new FastaEntry( cgr.toUCSCFormat(), cseq));
    }
    fe.close();
}

View Full Code Here

Examples of net.kuujo.copycat.test.TestLog.appendEntry()

   */
  public void testLeaderReplicatesSnapshotToOutOfSyncFollowers() throws Exception {
    Protocol<Member> protocol = new LocalProtocol();

    TestLog log1 = new TestLog();
    log1.appendEntry(new ConfigurationEntry(1, new ClusterConfig()
      .withLocalMember(new Member("foo"))
      .withRemoteMembers(new Member("bar"), new Member("baz"))));
    for (long i = 0; i < 1000; i++) {
      log1.appendEntry(new OperationEntry(1, "foo", Arrays.asList("bar", "baz")));
    }
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.