Package java.io

Examples of java.io.Reader.ready()


          StringBuffer buf = new StringBuffer();
          if (charCode == '<')
          {
            buf.append((char) charCode);
            while (reader.ready() && !end)
            {
              charCode = reader.read();
              buf.append((char) charCode);

              end = charCode == '>';
View Full Code Here


        String content = null;
        try
        {
            reader = new BufferedReader(new InputStreamReader(aDataSource
                    .getInputStream(), encoding), 2048);
            while (reader.ready())
                writer.write(reader.read());
            writer.flush();
            content = writer.toString();
        }
        catch (IllegalArgumentException e)
View Full Code Here

        Reader reader = serialClob.getCharacterStream();
        char[] data = new char[buf.length];
        int read = reader.read(data);
        assertEquals(buf.length, read);
        assertTrue(Arrays.equals(buf, data));
        assertFalse(reader.ready());

        MockSerialClob mockClob = new MockSerialClob();
        mockClob.characterStreamReader = new CharArrayReader(mockClob.buf);
        mockClob.asciiInputStream = new ByteArrayInputStream(new byte[] { 1 });
        mockClob.asciiOutputStream = new ByteArrayOutputStream();
View Full Code Here

        reader = serialClob.getCharacterStream();
        data = new char[mockClob.buf.length];
        read = reader.read(data);
        assertEquals(mockClob.buf.length, read);
        assertTrue(Arrays.equals(mockClob.buf, data));
        assertFalse(reader.ready());
    }

    public void testGetSubString() throws Exception {
        SerialClob serialClob = new SerialClob("hello".toCharArray());
View Full Code Here

    }

    @Override
    public boolean ready() throws IOException {
      Reader rdr = getReader();
      return rdr != null && rdr.ready();
    }

    @Override
    public boolean markSupported() {
      Reader rdr = getReader();
View Full Code Here

      // read input and wait for the public-key
      // line (starting with "pub:"
      InputStream out = p.getInputStream();
      Reader reader = new InputStreamReader(out);
      while (reader.ready())
      {
        String line = readLine(reader);
        if (line.startsWith("pub:"))
        {
          // trust value is always at 4th position
View Full Code Here

      try
      {
        // go through each output line
        // until the key is found
        while ((this.hostKey != null) && (r.ready()))
        {
          String line = this.readLine(r);

          // found secret key
          if (line.startsWith("sec:"))
View Full Code Here

      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

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.