use of org.teiid.client.lob.LobChunkInputStream 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));
}
use of org.teiid.client.lob.LobChunkInputStream in project teiid by teiid.
the class TestByteLobChunkStream method testGetChunk.
public void testGetChunk() throws Exception {
// $NON-NLS-1$
byte[] bytes = "hello world".getBytes();
ByteLobChunkStream stream = new ByteLobChunkStream(new ByteArrayInputStream(bytes), 5);
assertTrue(Arrays.equals(bytes, ObjectConverterUtil.convertToByteArray(new LobChunkInputStream(stream))));
}
use of org.teiid.client.lob.LobChunkInputStream in project teiid by teiid.
the class ResultSetImpl method createInputStreamFactory.
private InputStreamFactory createInputStreamFactory(Streamable<?> type) {
final StreamingLobChunckProducer.Factory factory = new StreamingLobChunckProducer.Factory(this.statement.getDQP(), this.requestID, type);
InputStreamFactory isf = new InputStreamFactory() {
@Override
public InputStream getInputStream() throws IOException {
return new LobChunkInputStream(factory.getLobChunkProducer());
}
};
return isf;
}
Aggregations