Design Patterns Java™ Workbook

(Michael S) #1
Chapter 27. Decorator

package com.oozinoz.io;
import java.io.*;
public abstract class OozinozFilter extends FilterWriter
{
protected OozinozFilter(Writer out)
{
super(out);
}


public void write(char cbuf[], int off, int len)
throws IOException
{
for (int i = 0; i < len; i++)
{
write(cbuf[i]);
}
}


public abstract void write(int c) throws IOException;


public void write(String s, int off, int len)
throws IOException
{
write(s.toCharArray(), off, len);
}
}


Oozinoz has a variety of output character stream decorators that manipulate text for display in
the company's Web site. Figure 27.3 shows the Oozinoz decorators.

Free download pdf