Package com.aoindustries.io
Class FindReplaceWriter
- java.lang.Object
-
- java.io.Writer
-
- com.aoindustries.io.FindReplaceWriter
-
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
public class FindReplaceWriter extends Writer
Replaces strings while writing. This class is not thread safe and requires external synchronization if used by more than one thread.- Author:
- AO Industries, Inc.
-
-
Constructor Summary
Constructors Constructor Description FindReplaceWriter(Writer out, char[] find, char[] replace)FindReplaceWriter(Writer out, String find, String replace)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FindReplaceWriterappend(char c)FindReplaceWriterappend(CharSequence csq)FindReplaceWriterappend(CharSequence csq, int start, int end)voidclose()voidflush()voidwrite(char[] cbuf, int off, int len)voidwrite(int c)voidwrite(String str, int off, int len)
-
-
-
Constructor Detail
-
FindReplaceWriter
public FindReplaceWriter(Writer out, char[] find, char[] replace)
- Parameters:
out- The writer that will receive the converted stream.find- The text to find. No defensive copy is made. Do not modify after giving to this writer.replace- The text to replace. No defensive copy is made. Do not modify after giving to this writer.
-
-
Method Detail
-
write
public void write(int c) throws IOException- Overrides:
writein classWriter- Throws:
IOException
-
write
public void write(char[] cbuf, int off, int len) throws IOException- Specified by:
writein classWriter- Throws:
IOException
-
write
public void write(String str, int off, int len) throws IOException
- Overrides:
writein classWriter- Throws:
IOException
-
append
public FindReplaceWriter append(CharSequence csq) throws IOException
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Throws:
IOException
-
append
public FindReplaceWriter append(CharSequence csq, int start, int end) throws IOException
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Throws:
IOException
-
append
public FindReplaceWriter append(char c) throws IOException
- Specified by:
appendin interfaceAppendable- Overrides:
appendin classWriter- Throws:
IOException
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Specified by:
flushin classWriter- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classWriter- Throws:
IOException
-
-