Package java.io

Examples of java.io.CharArrayWriter.toCharArray()


        }
        i++;
    } while (i < s.length() && !dontNeedEncoding.get((c = (int) s.charAt(i))));

    charArrayWriter.flush();
    String str = new String(charArrayWriter.toCharArray());
    byte[] ba = str.getBytes(charset);
    for (int j = 0; j < ba.length; j++) {
        out.append('%');
        char ch = Character.forDigit((ba[j] >> 4) & 0xF, 16);
        // converting to use uppercase letter as part of
View Full Code Here


    {
      bufWriter.write(buf, 0, read);
    }
    bufWriter.flush();
   
    return new CharArrayReader(bufWriter.toCharArray());
  }

  protected byte[] readBytes(Integer columnIndex) throws SQLException, IOException
  {
    InputStream is = null;
View Full Code Here

      CharArrayWriter writer = new CharArrayWriter();
      PrintWriter pw = new PrintWriter(writer);
      e.printStackTrace(pw);
      pw.flush();
     
      res.getWriter().print(writer.toCharArray());
    }
    else if (e instanceof ServletException)
      throw (ServletException) e;
    else if (e instanceof IOException)
      throw (IOException) e;
View Full Code Here

     * @since Commons IO 1.1
     */
    public static char[] toCharArray(InputStream is) throws IOException {
        CharArrayWriter output = new CharArrayWriter();
        copy(is, output);
        return output.toCharArray();
    }

    /**
     * Get the contents of an <code>InputStream</code> as a character array
     * using the specified character encoding.
View Full Code Here

     */
    public static char[] toCharArray(InputStream is, String encoding)
            throws IOException {
        CharArrayWriter output = new CharArrayWriter();
        copy(is, output, encoding);
        return output.toCharArray();
    }

    /**
     * Get the contents of a <code>Reader</code> as a character array.
     * <p>
 
View Full Code Here

     * @since Commons IO 1.1
     */
    public static char[] toCharArray(Reader input) throws IOException {
        CharArrayWriter sw = new CharArrayWriter();
        copy(input, sw);
        return sw.toCharArray();
    }

    // read toString
    //-----------------------------------------------------------------------
    /**
 
View Full Code Here

                int n;
                char[] buf = new char[8192];
                while ((n = r.read(buf)) > 0) {
                    w.write(buf, 0, n);
                }
                session.execute(new String(w.toCharArray()));
            } catch (Exception e) {
                LOGGER.debug("Error in initialization script", e);
                System.err.println("Error in initialization script: " + e.getMessage());
            } finally {
                if (r != null) {
View Full Code Here

            char buf[] = new char[1024];
            for (int i = 0 ; (i = reader.read(buf)) != -1 ;)
                caw.write(buf, 0, i);
            caw.close();
            if (current == null) {
                current = new Mark(this, caw.toCharArray(), fileid,
                                   getFile(fileid), master);
            } else {
                current.pushStream(caw.toCharArray(), fileid, getFile(fileid),
                                   longName);
            }
View Full Code Here

            caw.close();
            if (current == null) {
                current = new Mark(this, caw.toCharArray(), fileid,
                                   getFile(fileid), master);
            } else {
                current.pushStream(caw.toCharArray(), fileid, getFile(fileid),
                                   longName);
            }
        } catch (Throwable ex) {
            ExceptionUtils.handleThrowable(ex);
            log.error("Exception parsing file ", ex);
View Full Code Here

                i = i + 2;
            } else {
                caw.write(chars[i]);
            }
        }
        return caw.toCharArray();
    }

    public static char[] escapeQuotes (char []chars) {
        // Prescan to convert %\> to %>
        String s = new String(chars);
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.