5 import java.io.IOException;
8 /** Writer alters each char from 'A' to 'Z' range with next one just like
11 * @author Jaroslav Tulach
13 public class CryptoWriter implements Writer.Impl {
16 private CryptoWriter(Writer out) {
21 public static Writer create(Writer out) {
22 return Writer.create(new CryptoWriter(out));
26 public void write(char[] cbuf, int off, int len) throws IOException {
27 char[] arr = new char[len];
28 for (int i = 0; i < len; i++) {
29 arr[i] = convertChar(cbuf[off + i]);
31 out.write(arr, 0, len);
35 public void write(String str, int off, int len) throws IOException {
36 StringBuffer sb = new StringBuffer();
37 for (int i = 0; i < len; i++) {
38 sb.append(convertChar(str.charAt(off + i)));
40 out.write(sb.toString(), 0, len);
43 private char convertChar(int c) {
53 public void close() throws IOException {
57 public void flush() throws IOException {