Package java.io

Examples of java.io.InputStreamReader


   * @param url The url to download the informations from.
   * @param baseInfos The base infos for all available plugins.
   * @throws IOException
   */
  public SoftwareUpdater(URL url, PluginBaseInfo[] baseInfos) throws IOException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(IOUtilities.getStream(url, 300000),"ISO-8859-1"));

    mSoftwareUpdateItems=readSoftwareUpdateItems(reader,true,false,baseInfos);

    reader.close();
  }
View Full Code Here


   * @param onlyUpdates If only updates and not new items should be accepted.
   * @param dragNdrop If the plugin was dropped.
   * @throws IOException
   */
  SoftwareUpdater(URL url, boolean onlyUpdates, boolean dragNdrop) throws IOException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(IOUtilities.getStream(url, 300000),"ISO-8859-1"));

    mSoftwareUpdateItems=readSoftwareUpdateItems(reader,onlyUpdates,dragNdrop,null);

    reader.close();
  }
View Full Code Here

  private String toString(InputStream inputStream) throws IOException {
    String string;
    StringBuilder outputBuilder = new StringBuilder();
    if (inputStream != null) {
      BufferedReader reader =
          new BufferedReader(new InputStreamReader(inputStream));
      while (null != (string = reader.readLine())) {
        outputBuilder.append(string).append('\n');
      }
    }
    return outputBuilder.toString().trim();
View Full Code Here

      throws jjil.core.Error, IOException
    {
        this.fMinScale = fMinScale;
        this.fMaxScale = fMaxScale;
        // load Haar classifier cascade
        InputStreamReader isr = new InputStreamReader(is);
        this.hcc = HaarClassifierCascade.fromStream(isr);
    }
View Full Code Here

     * @param yahooUrl
     * @return
     */
    protected List executeUrl(String yahooUrl) throws TranslatorException {
        List rows = new ArrayList();
        InputStreamReader inSR  = null;
        BufferedReader buffReader = null;
       
        try {
            // create the URL object
            URL url = new URL(yahooUrl);
           
            // create the connection to the URL
            URLConnection conn = url.openConnection();

            // establish the connection to the URL                         
            conn.connect();
           
            // get the stream from the commection
            inSR = new InputStreamReader(conn.getInputStream());
           
            // place the stream into a buffered reader
            buffReader = new BufferedReader(inSR);         
           
            // now read each line from the Yahoo! Source and place
            // it into a StringBuffer object
            String line = null;
            while((line = buffReader.readLine()) != null){
                rows.add(parseLine(line));
            }
            // clean up our opened connections
            buffReader.close();
            inSR.close();
                       
        } catch(MalformedURLException mue){
            throw new TranslatorException(mue, mue.getMessage());
        } catch(IOException e) {
            throw new TranslatorException(e, e.getMessage());
View Full Code Here

        runFile(fileName);
    }

    private void runFile(String fileName) throws IOException {
        LineNumberReader reader = new LineNumberReader(new BufferedReader(
                new InputStreamReader(IOUtils.openFileInputStream(fileName))));
        while (true) {
            String line = reader.readLine();
            if (line == null) {
                break;
            }
View Full Code Here

 
  @Test public void testXmlParseBlobWithEncoding() throws Exception {
      String sql = "select xmlparse(document cast(? as blob)) x"; //$NON-NLS-1$
     
        List[] expected = new List[] {
            Arrays.asList(ObjectConverterUtil.convertToString(new InputStreamReader(new FileInputStream(UnitTestUtil.getTestDataFile("encoding.xml")), Charset.forName("ISO-8859-1")))),
        };   
   
        processPreparedStatement(sql, expected, dataManager, new DefaultCapabilitiesFinder(), FakeMetadataFactory.example1Cached(), Arrays.asList(blobFromFile("encoding.xml")));
    }
View Full Code Here

              frontUrl+"/section/"
                + section.getId()
                + ".html?static=true&nocache=true");
          BufferedReader reader =
            new BufferedReader(
              new InputStreamReader(url.openStream()));
          String content = "<!-- �ON static export -->";
          String line = "";
          while (line != null) {
            line = reader.readLine();
            if (line != null) {
              content += line;
            }
          }

          ZipEntry ze =
            new ZipEntry("section/" + section.getId() + ".html");
          zip.putNextEntry(ze);
          zip.write(content.getBytes());
          zip.closeEntry();
        } catch (Exception e) {
          System.out.println(
            "Static export error, section " + section.getId());
        }
      }

      // add publications
      Mapping.begin();
      Vector publications = Publication.listAll();
      Mapping.rollback();
      for (int i = 0; i < publications.size(); i++) {
        Publication publication = (Publication) publications.get(i);
        try {
          URL url =
            new URL(
              frontUrl+"/publication/"
                + publication.getId()
                + ".html?static=true&nocache=true");
          BufferedReader reader =
            new BufferedReader(
              new InputStreamReader(url.openStream()));
          String content = "<!-- �ON static export -->";
          String line = "";
          while (line != null) {
            line = reader.readLine();
            if (line != null) {
              content += line;
            }
          }
          ZipEntry ze =
            new ZipEntry(
              "publication/" + publication.getId() + ".html");
          zip.putNextEntry(ze);
          zip.write(content.getBytes());
          zip.closeEntry();
        } catch (Exception e) {
          System.out.println(
            "Static export error, publication "
              + publication.getId());
        }
      }

      // add index
      URL url =
        new URL(
          frontUrl+"?static=true&nocache=true");
      BufferedReader reader =
        new BufferedReader(new InputStreamReader(url.openStream()));
      String content = "<!-- �ON static export -->";
      String line = "";
      while (line != null) {
        line = reader.readLine();
        if (line != null) {
View Full Code Here

   * any logging written to the appender after the invocation will not
   * be accessible through the reader.
   * @return A reader for the current buffer.
   */
  public Reader getReader() {
    return new BufferedReader(new InputStreamReader(new ByteArrayInputStream(getBuffer())));
  }
View Full Code Here

  public void loadRuleFile(String filename)
    throws IOException
  {
    InputStream is = new FileInputStream(filename);
    BufferedReader reader =
      new BufferedReader(new InputStreamReader(is));

    String line = "";
    int lineno=0;

    while (line != null) {
View Full Code Here

TOP

Related Classes of java.io.InputStreamReader

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.