Search in sources :

Example 1 with LobChunkProducer

use of org.teiid.client.lob.LobChunkProducer in project teiid by teiid.

the class TestLobChunkInputStream method testReadByteArray.

public void testReadByteArray() throws Exception {
    LobChunkProducer chunkProducer = new LobChunkProducer() {

        // $NON-NLS-1$ //$NON-NLS-2$
        Iterator<LobChunk> chuncks = Arrays.asList(new LobChunk("hello ".getBytes(), false), new LobChunk("world".getBytes(), true)).iterator();

        @Override
        public LobChunk getNextChunk() throws IOException {
            return chuncks.next();
        }

        @Override
        public void close() throws IOException {
        }
    };
    LobChunkInputStream stream = new LobChunkInputStream(chunkProducer);
    // $NON-NLS-1$
    assertEquals("hello world", ObjectConverterUtil.convertToString(stream));
}
Also used : LobChunkProducer(org.teiid.client.lob.LobChunkProducer) LobChunk(org.teiid.client.lob.LobChunk) Iterator(java.util.Iterator) LobChunkInputStream(org.teiid.client.lob.LobChunkInputStream)

Aggregations

Iterator (java.util.Iterator)1 LobChunk (org.teiid.client.lob.LobChunk)1 LobChunkInputStream (org.teiid.client.lob.LobChunkInputStream)1 LobChunkProducer (org.teiid.client.lob.LobChunkProducer)1