Package com.day.util.diff
Class DiffWriter
- java.lang.Object
-
- java.io.Writer
-
- com.day.util.diff.DiffWriter
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.Appendable
,java.lang.AutoCloseable
public class DiffWriter extends java.io.Writer
Implements a writer that provides an additional methodwriteNewLine()
that can be used for writing line separators which can be defined. APrintWriter
would actually be better, but it does not support defining the line separator to use.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
LS_NATIVE
native line separatorstatic java.lang.String
LS_UNIX
unix line separatorstatic java.lang.String
LS_WINDOWS
windows line separator
-
Constructor Summary
Constructors Constructor Description DiffWriter(java.io.Writer out)
DiffWriter(java.io.Writer out, java.lang.String lineSeparator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
void
write(char[] cbuf)
void
write(char[] cbuf, int off, int len)
void
write(int c)
void
write(java.lang.String str)
void
write(java.lang.String str, int off, int len)
void
writeNewLine()
Writes a new line according to the defined line separator
-
-
-
Field Detail
-
LS_NATIVE
public static final java.lang.String LS_NATIVE
native line separator
-
LS_UNIX
public static final java.lang.String LS_UNIX
unix line separator- See Also:
- Constant Field Values
-
LS_WINDOWS
public static final java.lang.String LS_WINDOWS
windows line separator- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DiffWriter
public DiffWriter(java.io.Writer out)
-
DiffWriter
public DiffWriter(java.io.Writer out, java.lang.String lineSeparator)
- Parameters:
lineSeparator
- the line seperator to use forwriteNewLine()
-
-
Method Detail
-
writeNewLine
public void writeNewLine() throws java.io.IOException
Writes a new line according to the defined line separator- Throws:
java.io.IOException
- if an I/O error occurs
-
write
public void write(int c) throws java.io.IOException
- Overrides:
write
in classjava.io.Writer
- Throws:
java.io.IOException
-
write
public void write(char[] cbuf) throws java.io.IOException
- Overrides:
write
in classjava.io.Writer
- Throws:
java.io.IOException
-
write
public void write(char[] cbuf, int off, int len) throws java.io.IOException
- Specified by:
write
in classjava.io.Writer
- Throws:
java.io.IOException
-
write
public void write(java.lang.String str) throws java.io.IOException
- Overrides:
write
in classjava.io.Writer
- Throws:
java.io.IOException
-
write
public void write(java.lang.String str, int off, int len) throws java.io.IOException
- Overrides:
write
in classjava.io.Writer
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException
- Specified by:
flush
in interfacejava.io.Flushable
- Specified by:
flush
in classjava.io.Writer
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in classjava.io.Writer
- Throws:
java.io.IOException
-
-