Package org.apache.commons.io.output

Examples of org.apache.commons.io.output.StringBuilderWriter


     * @throws NullPointerException if the input is null
     * @throws IOException if an I/O error occurs
     * @since 2.3
     */
    public static String toString(final InputStream input, final Charset encoding) throws IOException {
        final StringBuilderWriter sw = new StringBuilderWriter();
        copy(input, sw, encoding);
        return sw.toString();
    }
View Full Code Here


     * @return the requested String
     * @throws NullPointerException if the input is null
     * @throws IOException if an I/O error occurs
     */
    public static String toString(final Reader input) throws IOException {
        final StringBuilderWriter sw = new StringBuilderWriter();
        copy(input, sw);
        return sw.toString();
    }
View Full Code Here

        URL url2 = getFeatureInfo.getFinalURL();
       
        GetFeatureInfoResponse response = wms.issueRequest(getFeatureInfo);
        assertEquals("text/html", response.getContentType() );
        InputStream stream = response.getInputStream();
        StringBuilderWriter writer = new StringBuilderWriter();
        IOUtils.copy(stream, writer );
       
        String info = writer.toString();
        assertTrue( "response available", !info.isEmpty() );
        assertTrue( "html", info.contains("<html") || info.contains("<HTML"));
        boolean forceXY = Boolean.getBoolean(GeoTools.FORCE_LONGITUDE_FIRST_AXIS_ORDER);
        String context = "srs="+srs+" forceXY="+forceXY+" Version="+version;
        if( !info.contains("tasmania_water_bodies.3") ){
View Full Code Here

  public void write(int depth, Writer writer2) throws IOException
  {
    if (!isTainted() || !isResolved() || isWritten())
      return;

    Writer writer= new StringBuilderWriter();

    oneWritten= true;
    written= true;

    for (ClassUnit child : getSupertypes())
View Full Code Here

     * @return the requested String
     * @throws NullPointerException if the input is null
     * @throws IOException if an I/O error occurs
     */
    public static String toString(InputStream input) throws IOException {
        StringBuilderWriter sw = new StringBuilderWriter();
        copy(input, sw);
        return sw.toString();
    }
View Full Code Here

     * @throws NullPointerException if the input is null
     * @throws IOException if an I/O error occurs
     */
    public static String toString(InputStream input, String encoding)
            throws IOException {
        StringBuilderWriter sw = new StringBuilderWriter();
        copy(input, sw, encoding);
        return sw.toString();
    }
View Full Code Here

     * @return the requested String
     * @throws NullPointerException if the input is null
     * @throws IOException if an I/O error occurs
     */
    public static String toString(Reader input) throws IOException {
        StringBuilderWriter sw = new StringBuilderWriter();
        copy(input, sw);
        return sw.toString();
    }
View Full Code Here

    }

    public static String toString(BaseURL url) {
        if (url == null) return null;
        if (isUrlEncoded()) {
            StringBuilderWriter urlXhtml = new StringBuilderWriter();
            try {
                url.write(urlXhtml, ESCAPE_XML);
                return urlXhtml.toString();
            } catch (IOException e) {
                StringBuilder msg = new StringBuilder().append("Error trying to escape BaseURL: ").append(url.toString())
                        .append(". Msg: ").append(e.toString());
                log.error(msg.toString(), e);
                // In case of error it returns a non escaped URL
View Full Code Here

        assertXpathNotExists("//tuv[@xml:lang='" + lang + "']", doc);
    }

    private Document writeToXmlWithValidation(StreamingOutput output)
            throws IOException, SAXException {
        StringBuilderWriter sbWriter = new StringBuilderWriter();
        WriterOutputStream writerOutputStream =
                new WriterOutputStream(sbWriter);
        output.write(writerOutputStream);
        writerOutputStream.close();
        String xml = sbWriter.toString();
        assertValidTMX(xml);
        DocumentBuilder controlParser = XMLUnit.newControlParser();
        controlParser.setEntityResolver(new TmxDtdResolver());
        Document doc =
                XMLUnit.buildDocument(controlParser, new StringReader(xml));
View Full Code Here

    }

    @Test
    public void givenUsingCommonsIO_whenConvertingByteArrayIntoWriter_thenCorrect() throws IOException {
        final byte[] initialArray = "With Commons IO".getBytes();
        final Writer targetWriter = new StringBuilderWriter(new StringBuilder(new String(initialArray)));

        targetWriter.close();
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.io.output.StringBuilderWriter

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.