Package java.io

Examples of java.io.InputStreamReader.ready()


      p.waitFor();
      Reader r = new InputStreamReader(p.getInputStream());

      // go through gpg's output until we find
      // a matching signature
      while (r.ready())
      {
        String[] tokens = this.readLine(r).split(":");
        if (tokens[0].equals("sig"))
        {
          // get only long key-id and not the
View Full Code Here


          new BufferedInputStream(p.getInputStream()));

      // wait for first gpg-messages, so we
      // don't write too early
      if (waitForOutput)
        while (!in.ready());

      OutputStream outputStream = p.getOutputStream();
      outputStream.write(out);
      outputStream.flush();
      outputStream.close();
View Full Code Here

      }

      StringBuffer line = new StringBuffer("");
      StringBuffer input = new StringBuffer("");
      String gpgMarker = "[GNUPG:]";
      while (in.ready())
      {
        char c = (char)in.read();
        line.append(c);
        if (c == '\n')
        {
View Full Code Here

    if (content instanceof InputStream)
    {
    Reader in = new InputStreamReader((InputStream)content);

    if (in.ready())
    {
      return in;
    }
    else
    {
View Full Code Here

         InputStreamReader reader = new InputStreamReader(ddStream);
         try
         {
            int idx = 0;
            int len = stringToFind.length;
            while (reader.ready())
            {
               int read = reader.read();
               if (read == stringToFind[idx])
               {
                  idx++;
View Full Code Here

    Assert.assertEquals(len, 4);
    Assert.assertEquals('T', c[0]);
    Assert.assertEquals('e', c[1]);
    Assert.assertEquals('s', c[2]);
    Assert.assertEquals('t', c[3]);
    Assert.assertFalse(isr.ready());
    isr.close();
    inputStream.close();
  }

  @Test
View Full Code Here

    InputStreamReader reader = null;
    try {
      reader = new InputStreamReader(inputStream, ENCODING_UTF_8);
      StringBuffer text = new StringBuffer();
      char[] buf = new char[5000];
      while (reader.ready()) {
        final int length = reader.read(buf);
        if (length == -1) break;
        text.append(buf, 0, length);
      }
      return text.toString();
View Full Code Here

            final InputStreamReader in = new InputStreamReader( new FileInputStream(file) );
            final StringBuffer contents = new StringBuffer( "" );

            char lastChar = '\0';

            while ( in.ready() ) {
                final char thisChar = (char) in.read();
                if ( thisChar == '\n' && lastChar != '\r' ) {
                    fail( "UNIX line ending found in '" +file.getName()+ "' - JSON files need to be CRLF for Windows" );
                }
                lastChar = thisChar;
View Full Code Here

    this.text = text;
   
    try {
      InputStreamReader istr = new InputStreamReader(text.getBinaryStream());
      StringWriter sw = new StringWriter();
      while(istr.ready()) {
        sw.write(istr.read());
      }
      this.textString = sw.getBuffer().toString();
    } catch (SQLException e) {
      throw new IllegalArgumentException("Invalid stream!", e);
View Full Code Here

    InputStreamReader reader = null;
    try {
      reader = new InputStreamReader(inputStream, ENCODING_UTF_8);
      StringBuffer text = new StringBuffer();
      char[] buf = new char[5000];
      while (reader.ready()) {
        final int length = reader.read(buf);
        if (length == -1) break;
        text.append(buf, 0, length);
      }
      return text.toString();
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.