public SaveOnReadInputStream(InputStream in, FileStoreInputStreamFactory fsisf) { super(in); this.fsisf = fsisf; fsos = fsisf.getOuputStream(); }
public SaveOnReadInputStream(InputStream in, FileStoreInputStreamFactory fsisf) { super(in); this.fsisf = fsisf; fsos = fsisf.getOuputStream(); }
public SaveOnReadInputStream(InputStream in, FileStoreInputStreamFactory fsisf) { super(in); this.fsisf = fsisf; fsos = fsisf.getOuputStream(); }
/** * The returned output stream is shared among all uses. * Once closed no further writing can occur * @return */ public FileStoreOutputStream getOuputStream() { return getOuputStream(DataTypeManager.MAX_LOB_MEMORY_BYTES); }
/** * The returned output stream is shared among all uses. * Once closed no further writing can occur * @return */ public FileStoreOutputStream getOuputStream() { return getOuputStream(DataTypeManager.MAX_LOB_MEMORY_BYTES); }
/** * The returned output stream is shared among all uses. * Once closed no further writing can occur * @return */ public FileStoreOutputStream getOuputStream() { return getOuputStream(DataTypeManager.MAX_LOB_MEMORY_BYTES); }
/** * Returns a new writer instance that is backed by the shared output stream. * Closing a writer will prevent further writes. * @return */ public Writer getWriter() { if (writer == null) { writer = new OutputStreamWriter(getOuputStream(), Charset.forName(encoding)); } return writer; }
/** * Returns a new writer instance that is backed by the shared output stream. * Closing a writer will prevent further writes. * @return */ public Writer getWriter() { if (writer == null) { writer = new OutputStreamWriter(getOuputStream(), Charset.forName(encoding)); } return writer; }
/** * Returns a new writer instance that is backed by the shared output stream. * Closing a writer will prevent further writes. * @return */ public Writer getWriter() { if (writer == null) { writer = new OutputStreamWriter(getOuputStream(), Charset.forName(encoding)); } return writer; }
public DocumentInProgress(FileStore store, String encoding) throws TeiidComponentException{ final FileStoreInputStreamFactory fsisf = new FileStoreInputStreamFactory(store, encoding); this.xml = new SQLXMLImpl(fsisf); this.xml.setEncoding(encoding); SAXTransformerFactory factory = new TransformerFactoryImpl(); try { //SAX2.0 ContentHandler handler = factory.newTransformerHandler(); handler.setResult(new StreamResult(fsisf.getOuputStream())); } catch (Exception e) { throw new TeiidComponentException(QueryPlugin.Event.TEIID30204, e); } transformer = handler.getTransformer(); transformer.setOutputProperty(OutputKeys.ENCODING, encoding); }
if (binary) { if (val instanceof BinaryType) { result.getOuputStream().write(((BinaryType)val).getBytesDirect()); return; InputStream binaryStream = b.getBinaryStream(); try { ObjectConverterUtil.write(result.getOuputStream(), binaryStream, -1, false); } finally { binaryStream.close();
if (binary) { if (val instanceof BinaryType) { result.getOuputStream().write(((BinaryType)val).getBytesDirect()); return; InputStream binaryStream = b.getBinaryStream(); try { ObjectConverterUtil.write(result.getOuputStream(), binaryStream, -1, false); } finally { binaryStream.close();
if (binary) { if (val instanceof BinaryType) { result.getOuputStream().write(((BinaryType)val).getBytesDirect()); return; InputStream binaryStream = b.getBinaryStream(); try { ObjectConverterUtil.write(result.getOuputStream(), binaryStream, -1, false); } finally { binaryStream.close();
@Test public void testInputStream() throws IOException { FileStore fs = BufferManagerFactory.getStandaloneBufferManager().createFileStore("test"); FileStoreInputStreamFactory factory = new FileStoreInputStreamFactory(fs, Streamable.ENCODING); OutputStream os = factory.getOuputStream(0); os.write(new byte[2]); os.close(); InputStream is = factory.getInputStream(0, 1); is.read(); assertEquals(-1, is.read()); }
/** * @see org.teiid.query.function.aggregate.AggregateFunction#getResult(CommandContext) */ public Object getResult(CommandContext commandContext) throws TeiidProcessingException{ if (this.result == null) { return null; } try { this.result.getWriter().close(); FileStoreOutputStream fs = this.result.getOuputStream(); fs.close(); if (binary) { if (fs.bytesWritten()) { return new BlobType(new BlobImpl(result)); } return new BlobType(new SerialBlob(Arrays.copyOf(fs.getBuffer(), fs.getCount()))); } if (fs.bytesWritten()) { return new ClobType(new ClobImpl(result, -1)); } return new ClobType(new ClobImpl(new String(Arrays.copyOf(fs.getBuffer(), fs.getCount()), Streamable.ENCODING))); } catch (IOException e) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30422, e); } catch (SQLException e) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30423, e); } } }
/** * @see org.teiid.query.function.aggregate.AggregateFunction#getResult(CommandContext) */ public Object getResult(CommandContext commandContext) throws TeiidProcessingException{ if (this.result == null) { return null; } try { this.result.getWriter().close(); FileStoreOutputStream fs = this.result.getOuputStream(); fs.close(); if (binary) { if (fs.bytesWritten()) { return new BlobType(new BlobImpl(result)); } return new BlobType(new SerialBlob(Arrays.copyOf(fs.getBuffer(), fs.getCount()))); } if (fs.bytesWritten()) { return new ClobType(new ClobImpl(result, -1)); } return new ClobType(new ClobImpl(new String(Arrays.copyOf(fs.getBuffer(), fs.getCount()), Streamable.ENCODING))); } catch (IOException e) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30422, e); } catch (SQLException e) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30423, e); } } }
/** * @see org.teiid.query.function.aggregate.AggregateFunction#getResult(CommandContext) */ public Object getResult(CommandContext commandContext) throws TeiidProcessingException{ if (this.result == null) { this.result = buildResult(commandContext); } try { this.result.getWriter().close(); FileStoreOutputStream fs = this.result.getOuputStream(); fs.close(); if (binary) { if (fs.bytesWritten()) { return new BlobType(new BlobImpl(result)); } return new BlobType(new SerialBlob(Arrays.copyOf(fs.getBuffer(), fs.getCount()))); } if (fs.bytesWritten()) { return new ClobType(new ClobImpl(result, -1)); } return new ClobType(new ClobImpl(new String(Arrays.copyOf(fs.getBuffer(), fs.getCount()), Streamable.ENCODING))); } catch (IOException e) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30422, e); } catch (SQLException e) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30423, e); } } }
/** * @see org.teiid.query.function.aggregate.AggregateFunction#getResult(CommandContext) */ public Object getResult(CommandContext commandContext) throws TeiidProcessingException{ if (this.result == null) { this.result = buildResult(commandContext); } try { FileStoreOutputStream fs = this.result.getOuputStream(); fs.close(); if (fs.bytesWritten()) { return new BlobType(new BlobImpl(result)); } return new BlobType(new SerialBlob(Arrays.copyOf(fs.getBuffer(), fs.getCount()))); } catch (IOException e) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30422, e); } catch (SQLException e) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30423, e); } } }
/** * @see org.teiid.query.function.aggregate.AggregateFunction#getResult(CommandContext) */ public Object getResult(CommandContext commandContext) throws TeiidProcessingException{ if (this.result == null) { this.result = buildResult(commandContext); } try { FileStoreOutputStream fs = this.result.getOuputStream(); fs.close(); if (fs.bytesWritten()) { return new BlobType(new BlobImpl(result)); } return new BlobType(new SerialBlob(Arrays.copyOf(fs.getBuffer(), fs.getCount()))); } catch (IOException e) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30422, e); } catch (SQLException e) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30423, e); } } }
/** * @see org.teiid.query.function.aggregate.AggregateFunction#getResult(CommandContext) */ public Object getResult(CommandContext commandContext) throws TeiidProcessingException{ if (this.result == null) { this.result = buildResult(commandContext); } try { FileStoreOutputStream fs = this.result.getOuputStream(); fs.close(); if (fs.bytesWritten()) { return new BlobType(new BlobImpl(result)); } return new BlobType(new SerialBlob(Arrays.copyOf(fs.getBuffer(), fs.getCount()))); } catch (IOException e) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30422, e); } catch (SQLException e) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID30423, e); } } }