de.olafpanz.translationtable
Class ASCIIFilterWriter

java.lang.Object
  extended by java.io.Writer
      extended by de.olafpanz.translationtable.ASCIIFilterWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

final class ASCIIFilterWriter
extends java.io.Writer

Filters unicodes out and write them as \\uXXXX.

Author:
Olaf Panz

Field Summary
private  java.io.Writer writer
          Next writer in pipe.
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
ASCIIFilterWriter(java.io.Writer writer)
          Create new instance
 
Method Summary
 void close()
          Delegate to next in pipe.
static java.lang.String convert(java.lang.String str)
          Convert string to unicode.
 void flush()
          Delegate to next in pipe.
 void write(char[] ac, int i, int j)
          Filter and Delegate to next in pipe.
 
Methods inherited from class java.io.Writer
append, append, append, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

writer

private final java.io.Writer writer
Next writer in pipe.

Constructor Detail

ASCIIFilterWriter

public ASCIIFilterWriter(java.io.Writer writer)
Create new instance

Parameters:
writer - Next writer in pipe.
Method Detail

convert

public static final java.lang.String convert(java.lang.String str)
Convert string to unicode. Do not allow '"' in result, escape it.

Parameters:
str - String to convert.
Returns:
ASCII-String

close

public void close()
           throws java.io.IOException
Delegate to next in pipe.

Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Writer
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Delegate to next in pipe.

Specified by:
flush in interface java.io.Flushable
Specified by:
flush in class java.io.Writer
Throws:
java.io.IOException

write

public void write(char[] ac,
                  int i,
                  int j)
           throws java.io.IOException
Filter and Delegate to next in pipe.

Specified by:
write in class java.io.Writer
Throws:
java.io.IOException