Package java.io

Examples of java.io.CharArrayWriter.toCharArray()


    caw.write('>');
    i = i + 3;
      }
      else caw.write(chars[i]);
  }
  return caw.toCharArray();
    }

    // Checks if the token is a runtime expression.
    public static boolean isExpression (String token) {
 
View Full Code Here


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

        charArrayWriter.flush();
        String str = new String(charArrayWriter.toCharArray());
        byte[] ba = str.getBytes(charset);
        for (byte b : ba)
        {
          out.append('%');
          char ch = Character.forDigit((b >> 4) & 0xF, 16);
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, encoding );
      } else {
    current.pushStream( caw.toCharArray(), fileid, getFile(fileid),
            master, encoding );
      }
View Full Code Here

      caw.close();
      if (current == null) {
    current = new Mark( this, caw.toCharArray(), fileid, getFile(fileid),
            master, encoding );
      } else {
    current.pushStream( caw.toCharArray(), fileid, getFile(fileid),
            master, encoding );
      }

        } catch (FileNotFoundException fnfe) {
            throw fnfe;
View Full Code Here

      CharArrayWriter caw = new CharArrayWriter();
      while (!stop.equals(mark()))
    caw.write(nextChar());
      caw.close();
      reset(oldstart);
      return caw.toCharArray();
  } catch( Exception ex ) {
      ex.printStackTrace();
      throw new ParseException( ex.toString() );
  }
    }
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, encoding);
            } else {
                current.pushStream(caw.toCharArray(), fileid, getFile(fileid),
                                   longName, encoding);
            }
View Full Code Here

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

            catch ( IOException ioe )
            {
            }
        }

        char[] isca = writer.toCharArray();
        return isca;
    }


    public static byte[] getBytesFromResource( String resource ) throws IOException
View Full Code Here

  public void testEncodeArrayNoSpecialChars() {
    try {
      CharArrayWriter writer = new CharArrayWriter();
      char[] source = stringNoSpecialChars.toCharArray();
      HTMLEncoder.encode(source, 0, source.length, writer);
      assertEquals(stringNoSpecialCharsEncoded.toCharArray(), writer.toCharArray());
    } catch (IOException e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

  public void testEncodeArrayNoSpecialCharsPartial() {
    try {
      CharArrayWriter writer = new CharArrayWriter();
      char[] source = stringNoSpecialChars.toCharArray();
      HTMLEncoder.encode(source, 3, source.length - 5, writer);
      assertEquals(stringNoSpecialCharsEncodedPartial.toCharArray(), writer.toCharArray());
    } catch (IOException e) {
      fail(e.getMessage());
    }
  }
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.