Module com.github.rvesse.airline.io
Class ColorizedWriter<T>
- java.lang.Object
-
- java.io.Writer
-
- java.io.FilterWriter
-
- com.github.rvesse.airline.io.writers.AnsiWriter
-
- com.github.rvesse.airline.io.writers.ColorizedWriter<T>
-
- Type Parameters:
T
- Color type
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.Appendable
,java.lang.AutoCloseable
- Direct Known Subclasses:
Ansi256ColorizedWriter
,AnsiBasicColorizedWriter
,AnsiTrueColorizedWriter
public class ColorizedWriter<T> extends AnsiWriter
An writer stream that supports colorization and basic text decorations
-
-
Field Summary
Fields Modifier and Type Field Description protected WriterControlTracker<T>
backgroundControl
protected WriterControlTracker<BasicDecoration>
bold
protected WriterControlTracker<T>
foregroundControl
protected WriterControlTracker<BasicDecoration>
italic
protected WriterControlTracker<BasicDecoration>
strikeThrough
protected WriterControlTracker<BasicDecoration>
underline
-
Constructor Summary
Constructors Constructor Description ColorizedWriter(java.io.Writer writer, ControlCodeSource<T> foregroundColorSource, ControlCodeSource<T> backgroundColorSource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ColorizedWriter<T>
resetBackgroundColor()
ColorizedWriter<T>
resetForegroundColor()
ColorizedWriter<T>
setBackgroundColor(T color)
ColorizedWriter<T>
setBold(boolean enabled)
protected ColorizedWriter<T>
setDecoration(boolean enabled, BasicDecoration decoration, WriterControlTracker<BasicDecoration> control)
ColorizedWriter<T>
setForegroundColor(T color)
ColorizedWriter<T>
setItalic(boolean enabled)
ColorizedWriter<T>
setStrikeThrough(boolean enabled)
ColorizedWriter<T>
setUnderline(boolean enabled)
-
Methods inherited from class com.github.rvesse.airline.io.writers.AnsiWriter
applyAll, close, registerControl, registerControls, resetAll, write, write, write
-
-
-
-
Field Detail
-
foregroundControl
protected WriterControlTracker<T> foregroundControl
-
backgroundControl
protected WriterControlTracker<T> backgroundControl
-
bold
protected WriterControlTracker<BasicDecoration> bold
-
italic
protected WriterControlTracker<BasicDecoration> italic
-
underline
protected WriterControlTracker<BasicDecoration> underline
-
strikeThrough
protected WriterControlTracker<BasicDecoration> strikeThrough
-
-
Constructor Detail
-
ColorizedWriter
public ColorizedWriter(java.io.Writer writer, ControlCodeSource<T> foregroundColorSource, ControlCodeSource<T> backgroundColorSource)
-
-
Method Detail
-
setForegroundColor
public ColorizedWriter<T> setForegroundColor(T color)
-
resetForegroundColor
public ColorizedWriter<T> resetForegroundColor() throws java.io.IOException
- Throws:
java.io.IOException
-
setBackgroundColor
public ColorizedWriter<T> setBackgroundColor(T color)
-
resetBackgroundColor
public ColorizedWriter<T> resetBackgroundColor() throws java.io.IOException
- Throws:
java.io.IOException
-
setBold
public ColorizedWriter<T> setBold(boolean enabled) throws java.io.IOException
- Throws:
java.io.IOException
-
setItalic
public ColorizedWriter<T> setItalic(boolean enabled) throws java.io.IOException
- Throws:
java.io.IOException
-
setUnderline
public ColorizedWriter<T> setUnderline(boolean enabled) throws java.io.IOException
- Throws:
java.io.IOException
-
setStrikeThrough
public ColorizedWriter<T> setStrikeThrough(boolean enabled) throws java.io.IOException
- Throws:
java.io.IOException
-
setDecoration
protected final ColorizedWriter<T> setDecoration(boolean enabled, BasicDecoration decoration, WriterControlTracker<BasicDecoration> control) throws java.io.IOException
- Throws:
java.io.IOException
-
-