Code example for ByteArrayOutputStream

Methods: reset, toByteArray

0
 
    @Test  
    public void testPipe() throws IOException { 
        DBObject obj = createSimpleTestDoc();
        e.putObject(obj);
        buf.pipe(bios);
 
        LazyDBObject lazyDBObj = (LazyDBObject) lazyDBDecoder.decode(new ByteArrayInputStream(bios.toByteArray()), 
                (DBCollection) null); 
        bios.reset();
        int byteCount = lazyDBObj.pipe(bios);
        assertEquals(lazyDBObj.getBSONSize(), byteCount);
 
        LazyDBObject lazyDBObjectFromPipe = (LazyDBObject) lazyDBDecoder.decode(new ByteArrayInputStream(bios.toByteArray()),
                (DBCollection) null); 
         
        assertEquals(lazyDBObj, lazyDBObjectFromPipe);
    } 
 
    @Test 
    public void testLazyDBEncoder() throws IOException {