public InputStream getInputStream(long start, long len) { if (fsos != null && !fsos.bytesWritten()) { if (start > Integer.MAX_VALUE) { throw new AssertionError("Invalid start " + start); //$NON-NLS-1$ } int s = (int)start; int intLen = fsos.getCount() - s; if (len >= 0) { intLen = (int)Math.min(len, len); } return new ByteArrayInputStream(fsos.getBuffer(), s, intLen); } return lobBuffer.createInputStream(start, len); }
public InputStream getInputStream(long start, long len) { if (fsos != null && !fsos.bytesWritten()) { if (start > Integer.MAX_VALUE) { throw new AssertionError("Invalid start " + start); //$NON-NLS-1$ } int s = (int)start; int intLen = fsos.getCount() - s; if (len >= 0) { intLen = (int)Math.min(len, len); } return new ByteArrayInputStream(fsos.getBuffer(), s, intLen); } return lobBuffer.createInputStream(start, len); }
public InputStream getInputStream(long start, long len) { if (fsos != null && !fsos.bytesWritten()) { if (start > Integer.MAX_VALUE) { throw new AssertionError("Invalid start " + start); //$NON-NLS-1$ } int s = (int)start; int intLen = fsos.getCount() - s; if (len >= 0) { intLen = (int)Math.min(len, len); } return new ByteArrayInputStream(fsos.getBuffer(), s, intLen); } return lobBuffer.createInputStream(start, len); }
/** * @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) { 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 { 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); } } }
public byte[] getMemoryBytes() { if (fsos != null && !fsos.bytesWritten() && fsos.getBuffer().length == fsos.getCount()) { return fsos.getBuffer(); } throw new IllegalStateException("In persistent mode or not closed for writing"); //$NON-NLS-1$ }
@Override public long getLength() { if (fsos != null && !fsos.bytesWritten()) { return fsos.getCount(); } return lobBuffer.getLength(); }
@Override public long getLength() { if (fsos != null && !fsos.bytesWritten()) { return fsos.getCount(); } return lobBuffer.getLength(); }
@Override public StorageMode getStorageMode() { if (fsos == null || fsos.bytesWritten()) { return StorageMode.PERSISTENT; } return StorageMode.MEMORY; } }
@Override public long getLength() { if (fsos != null && !fsos.bytesWritten()) { return fsos.getCount(); } return lobBuffer.getLength(); }
@Override public StorageMode getStorageMode() { if (fsos == null || fsos.bytesWritten()) { return StorageMode.PERSISTENT; } return StorageMode.MEMORY; }
public byte[] getMemoryBytes() { if (fsos != null && !fsos.bytesWritten() && fsos.getBuffer().length == fsos.getCount()) { return fsos.getBuffer(); } throw new IllegalStateException("In persistent mode or not closed for writing"); //$NON-NLS-1$ }
@Override public StorageMode getStorageMode() { if (fsos == null || fsos.bytesWritten()) { return StorageMode.PERSISTENT; } return StorageMode.MEMORY; }
public byte[] getMemoryBytes() { if (fsos != null && !fsos.bytesWritten() && fsos.getBuffer().length == fsos.getCount()) { return fsos.getBuffer(); } throw new IllegalStateException("In persistent mode or not closed for writing"); //$NON-NLS-1$ }