Package java.io

Examples of java.io.FilterWriter


{
   
  public void test (TestHarness harness)
  {
    CharArrayWriter caw = new CharArrayWriter();
    FilterWriter tfw = new MyFilterWriter(caw);
    try {
      tfw.write('A');            // A
      harness.check(true, "write(int)");
      char[] ba = {'A', 'B', 'C', 'D'};
      tfw.write(ba, 1, 2);        // ABC
      harness.check(true, "write(buf,off,len)");
      tfw.write("CDEF", 1, 3);      // ABCDEF
      harness.check(caw.toString(), "ABCDEF", "wrote all characters okay");
      tfw.flush();
      harness.check(true, "flush()");
      tfw.close();
      harness.check(true, "close()");
    }
    catch (IOException e) {
      harness.debug(e);
      harness.fail("IOException unexpected");
View Full Code Here


            + "\n\n* list2"
            + "\n\n* list2{pre}123{/pre}"
            + "\n123";

        output = new StringWriter();
        Sink sink = new TextSink( new FilterWriter( output )
        {
            public void close() throws IOException
            {
                super.close();
                this.out = null;
View Full Code Here

    }

    @Override
    public HierarchicalStreamWriter createWriter(final Writer out) {
        final HierarchicalStreamWriter[] writer = new HierarchicalStreamWriter[1];
        final FilterWriter filter = new FilterWriter(out) {
            @Override
            public void close() {
                writer[0].close();
            }
        };
View Full Code Here

        }
    }

    public HierarchicalStreamWriter createWriter(final Writer out) {
        final HierarchicalStreamWriter[] writer = new HierarchicalStreamWriter[1];
        final FilterWriter filter = new FilterWriter(out){
            public void close() {
                writer[0].close();
            }
        };
        writer[0] = new Dom4JWriter(new XMLWriter(filter,  outputFormat), xmlFriendlyReplacer());
View Full Code Here

            + "\n\n* list2"
            + "\n\n* list2{pre}123{/pre}"
            + "\n123";

        output = new StringWriter();
        Sink sink = new TextSink( new FilterWriter( output )
        {
            public void close() throws IOException
            {
                super.close();
                this.out = null;
View Full Code Here

*/
public final class StreamUtils {
    private static final AtomicInteger threadId = new AtomicInteger();

    public static Writer prefixWriter(Writer out, final String prefix) {
        return new FilterWriter(out) {
            private boolean first = true;

            @Override
            public void write(int c) throws IOException {
                if (first) {
View Full Code Here

*
* @author Kohsuke Kawaguchi (kk@kohsuke.org)
*/
public class DumpCodeWriter implements CodeWriter {
    public IndentingWriter create(File file) {
        IndentingWriter w = new IndentingWriter(new FilterWriter(new OutputStreamWriter(System.out)) {
            public void close() throws IOException {
                flush();
                // don't close ignore
            }
        }, true);
View Full Code Here

      // prepare directory to write log files to
      String logDir = HostedModeSupport.getTemporaryDirectoryName(javaProject);
      // prepare logger
      Writer rotatingWriter =
          RotatingFileWriter.getInstance(logDir + File.separator + ".gwt-log", 10, 3);
      m_writer = new PrintWriter(new FilterWriter(rotatingWriter) {
        private String m_buffer = new String();
        @Override
        public void write(String message, int off, int len) throws IOException {
          super.write(message, off, len);
          int eolIndex = message.indexOf(LINE_SEPARATOR);
View Full Code Here

      // prepare directory to write log files to
      String logDir = HostedModeSupport.getTemporaryDirectoryName(javaProject);
      // prepare logger
      Writer rotatingWriter =
          RotatingFileWriter.getInstance(logDir + File.separator + ".gwt-log", 10, 3);
      this.writer = new PrintWriter(new FilterWriter(rotatingWriter) {
        private String buffer = new String();

        @Override
        public void write(String message, int off, int len) throws IOException {
          super.write(message, off, len);
View Full Code Here

  private static CheckCloseSupplier.Output<Writer> newCheckWriter(
      OutputSupplier<? extends Writer> delegate) {
    return new CheckCloseSupplier.Output<Writer>(delegate) {
      @Override protected Writer wrap(Writer object, final Callback callback) {
        return new FilterWriter(object) {
          @Override public void close() throws IOException {
            callback.delegateClosed();
            super.close();
          }
        };
View Full Code Here

TOP

Related Classes of java.io.FilterWriter

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.