Package org.teiid.core.util

Examples of org.teiid.core.util.ReaderInputStream


          break;
       
        case PG_TYPE_TEXT:
          Clob clob = rs.getClob(column);
          if (clob != null) {
            bytes = ObjectConverterUtil.convertToByteArray(new ReaderInputStream(clob.getCharacterStream(), this.encoding), this.maxLobSize);
          }             
          break;
         
        case PG_TYPE_BYTEA:
          Blob blob = rs.getBlob(column);
View Full Code Here


          streams.add(((SQLXMLImpl)obj).getBinaryStream());
            StreamFactoryReference sfr = new SQLXMLImpl();
            references.add(sfr);
            return sfr;
          } else if (obj instanceof ClobImpl) {
            streams.add(new ReaderInputStream(((ClobImpl)obj).getCharacterStream(), Charset.forName(Streamable.ENCODING)));
            StreamFactoryReference sfr = new ClobImpl();
            references.add(sfr);
            return sfr;
          } else if (obj instanceof BlobImpl) {
            streams.add(((Blob)obj).getBinaryStream());
            StreamFactoryReference sfr = new BlobImpl();
            references.add(sfr);
            return sfr;
          }
        } catch (SQLException e) {
          throw new IOException(e);
        }
      }
      else if (obj instanceof Serializable) {
        return obj;
      }
      else {
      try {
          if (obj instanceof Reader) {
            streams.add(new ReaderInputStream((Reader)obj, Charset.forName(Streamable.ENCODING)));
            StreamFactoryReference sfr = new SerializableReader();
            references.add(sfr);
            return sfr;
          } else if (obj instanceof InputStream) {
            streams.add((InputStream)obj);
            StreamFactoryReference sfr = new SerializableInputStream();
            references.add(sfr);
            return sfr;
          } else if (obj instanceof SQLXML) {
          streams.add(((SQLXML)obj).getBinaryStream());
            StreamFactoryReference sfr = new SQLXMLImpl();
            references.add(sfr);
            return sfr;
          } else if (obj instanceof Clob) {
            streams.add(new ReaderInputStream(((Clob)obj).getCharacterStream(), Charset.forName(Streamable.ENCODING)));
            StreamFactoryReference sfr = new ClobImpl();
            references.add(sfr);
            return sfr;
          } else if (obj instanceof Blob) {
            streams.add(((Blob)obj).getBinaryStream());
View Full Code Here

    }
     
      @Override
      public InputStream getInputStream() throws IOException {
        try {
        return new ReaderInputStream(clob.getCharacterStream(), charset);
      } catch (SQLException e) {
        throw new IOException(e);
      }
      }
View Full Code Here

     * @return an ascii stream containing the <code>CLOB</code> data
     * @exception SQLException if there is an error accessing the
     * <code>CLOB</code> value
     */
    public InputStream getAsciiStream() throws SQLException {
      return new ReaderInputStream(getCharacterStream(), Charset.forName("US-ASCII")); //$NON-NLS-1$
    }
View Full Code Here

    private ClobStreamProvider(Clob searchstr) {
      this.searchstr = searchstr;
    }

    public InputStream getBinaryStream() throws SQLException {
      ReaderInputStream ris = new ReaderInputStream(searchstr.getCharacterStream(), Charset.forName("UTF-16")); //$NON-NLS-1$
      try {
        ris.skip(2);
        return ris;
      } catch (IOException e) {
        throw new SQLException(e);
      }
    }
View Full Code Here

    FileStore fs = buffMgr.createFileStore("temp");
   
    ClobType clob = new ClobType(new ClobImpl(new InputStreamFactory() {
      @Override
      public InputStream getInputStream() throws IOException {
        return new ReaderInputStream(new StringReader("Clob contents One"),  Charset.forName(Streamable.ENCODING));
      }
     
    }, -1));
   
    BlobType blob = new BlobType(new BlobImpl(new InputStreamFactory() {
      @Override
      public InputStream getInputStream() throws IOException {
        return new ReaderInputStream(new StringReader("Blob contents Two"),  Charset.forName(Streamable.ENCODING));
      }
     
    }));   
   
    LobManager lobManager = new LobManager();
View Full Code Here

    ObjectEncoderOutputStream out = new ObjectEncoderOutputStream(new DataOutputStream(baos), 512);
   
    ClobImpl clob = new ClobImpl(new InputStreamFactory() {
      @Override
      public InputStream getInputStream() throws IOException {
        return new ReaderInputStream(new StringReader("Clob contents"),  Charset.forName(Streamable.ENCODING)); //$NON-NLS-1$
      }
     
    }, -1);
   
    out.writeObject(clob);
View Full Code Here

    }
    this.setObject(parameterIndex, new ClobImpl(new InputStreamFactory() {
     
      @Override
      public InputStream getInputStream() throws IOException {
        return new ReaderInputStream(reader, Charset.forName(Streamable.ENCODING));
      }
    }, -1));
  }
View Full Code Here

                XMLType xml = (XMLType)streamable;
                return new ByteLobChunkStream(xml.getBinaryStream(), chunkSize);
            }
            else if (streamable instanceof ClobType) {
                ClobType clob = (ClobType)streamable;
                return new ByteLobChunkStream(new ReaderInputStream(clob.getCharacterStream(), Charset.forName(Streamable.ENCODING)), chunkSize);           
            }
            BlobType blob = (BlobType)streamable;
            return new ByteLobChunkStream(blob.getBinaryStream(), chunkSize);                       
        } catch(SQLException e) {
            throw new IOException(e);
View Full Code Here

          InputStream is = null;
          try {
            if (file instanceof SQLXML) {
              is = ((SQLXML)file).getBinaryStream();
            } else if (file instanceof Clob) {
              is = new ReaderInputStream(((Clob)file).getCharacterStream(), encoding);
            } else if (file instanceof Blob) {
              is = ((Blob)file).getBinaryStream();
            } else {
              throw new TranslatorException(UTIL.getString("unknown_type")); //$NON-NLS-1$
            }
View Full Code Here

TOP

Related Classes of org.teiid.core.util.ReaderInputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.