Examples of ReaderInputStream


Examples of org.jnode.util.ReaderInputStream

    public void testBadUnicode2() throws Exception {
        char[] chars = new char[] {'a', '\ud800'};
        final String LINE = new String(chars);
        try {
            Reader r = new StringReader(LINE.substring(1));
            ReaderInputStream ris = new ReaderInputStream(r, "UTF-8");
            InputStreamReader isr = new InputStreamReader(ris);
            isr.read();
            Assert.fail("No exception raised");
        } catch (MalformedInputException ex) {
            // expected
        }

        Reader r = new StringReader(LINE.substring(0, 1));
        ReaderInputStream ris = new ReaderInputStream(r, "UTF-8");
        InputStreamReader isr = new InputStreamReader(ris);
        Assert.assertEquals(chars[0], isr.read());
    }
View Full Code Here

Examples of org.jruby.embed.io.ReaderInputStream

     * Test of available method, of class ReaderInputStream.
     */
    @Test
    public void testAvailable() throws Exception {
        logger1.info("available");
        ReaderInputStream instance = new ReaderInputStream(new FileReader(filename));
        int expResult = 40;
        int result = instance.available();
        assertEquals(expResult, result);
        instance.close();
    }
View Full Code Here

Examples of org.netbeans.gradle.project.output.ReaderInputStream

                Arrays.asList(taskDef.getStdErrListener(project)),
                errorConsumers));

        buildLauncher.setStandardOutput(new WriterOutputStream(forwardedStdOut));
        buildLauncher.setStandardError(new WriterOutputStream(forwardedStdErr));
        buildLauncher.setStandardInput(new ReaderInputStream(tab.getIo().getInRef()));

        return new OutputRef(forwardedStdOut, forwardedStdErr);
    }
View Full Code Here

Examples of org.restlet.engine.io.ReaderInputStream

            buf.append(Integer.toString(i)).append('-');
        }

        String s = buf.toString();
        Reader r = new StringReader(s);
        InputStream is = new ReaderInputStream(r);

        InputRepresentation ir = new InputRepresentation(is);
        ir.setCharacterSet(CharacterSet.ISO_8859_1);

        assertEquals("Value", s, ir.getText());
View Full Code Here

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

Examples of org.teiid.core.util.ReaderInputStream

          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

Examples of org.teiid.core.util.ReaderInputStream

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

Examples of org.teiid.core.util.ReaderInputStream

     * @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

Examples of org.teiid.core.util.ReaderInputStream

    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

Examples of org.teiid.core.util.ReaderInputStream

    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
TOP
Copyright © 2018 www.massapi.com. 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.