Example usage for java.io FilterWriter write

List of usage examples for java.io FilterWriter write

Introduction

In this page you can find the example usage for java.io FilterWriter write.

Prototype

public void write(String str, int off, int len) throws IOException 

Source Link

Document

Writes a portion of a string.

Usage

From source file:Main.java

public static void main(String[] args) throws Exception {

    char[] cbuf = { 'A', 'B', 'C', 'D', 'E', 'F' };

    Writer w = new StringWriter(6);

    FilterWriter fw = new FilterWriter(w) {
    };//from  w  ww .j a v a2  s . c om

    fw.write(cbuf, 2, 4);

    String s = w.toString();

    System.out.print(s);
}

From source file:Main.java

public static void main(String[] args) throws Exception {

    String str = "from java2s.com";
    Writer w = new StringWriter(6);

    FilterWriter fw = new FilterWriter(w) {
    };/*  w ww  .jav  a2s  . c o m*/

    fw.write(str, 5, 7);

    String s = w.toString();

    System.out.print(s);

}