Class IndentedPrintStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- java.io.PrintStream
-
- org.symphonyoss.symphony.messageml.util.IndentedPrintStream
-
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
- Direct Known Subclasses:
XmlPrintStream
public class IndentedPrintStream extends PrintStream
A PrintStream with added indenting functionality.- Author:
- Bruce Skingle
-
-
Field Summary
-
Fields inherited from class java.io.FilterOutputStream
out
-
-
Constructor Summary
Constructors Constructor Description IndentedPrintStream(OutputStream outputStream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidalign(Object... s)Takes an array of strings to be aligned in separate columns, and adds them to the alignedblockvoidcloseBlock()Outdents the line and prints a close curly bracket on the following linevoidcloseBlock(String s)Outdents the current line and prints a close curly bracket on the next line, followed by a stringvoidcontinueBlock(String s)Ends one block (outdent followed by a close curly bracket on the following line) prints a string on its own line and begins a new block (open curly bracket followed by an indent on the following linevoidforceNewLine()Print a linebreak unless we are at the start of a line.StringgetLinePrefix()longgetOffset()booleangetPrintOffsets()voidindent()Increases the indent on the current linebooleanisNoIndent()booleanisNoNl()booleanisoNlCr()booleanisRemoveNl()voidopenBlock()prints an open curly bracket and indents the following linevoidopenBlock(String s)Prints a string, an open curly bracket on its own line and indents the following linevoidoutdent()Decreases the indent on the current linevoidprint(boolean b)print a boolean with no indentvoidprint(char c)print a character with no indentvoidprint(char[] s)print a character array with no indentvoidprint(double d)print a double with no indentvoidprint(float f)print a floating point number with no indentvoidprint(int i)print an integer with no indentvoidprint(int tempIndent, boolean b)Indent the current line and print a boolean on the same linevoidprint(int tempIndent, char c)Indent the current line and print a character on the same linevoidprint(int tempIndent, char[] s)Indent the current line and print a character array on the same linevoidprint(int tempIndent, double d)Indent the current line and print a double on the same linevoidprint(int tempIndent, float f)Indent the current line and print a floating point number on the same linevoidprint(int tempIndent, int i)Indent the current line and print an integer on the same linevoidprint(int tempIndent, long l)Indent the current line and print a long integer on the same linevoidprint(int tempIndent, Object obj)Indent the current line and print an object on the same linevoidprint(int tempIndent, String s)Indent the current line and print a string on the same linevoidprint(int indent, String pattern, Object... arguments)Calls string.format, indents and printsvoidprint(long l)print a long integer with no indentvoidprint(Object obj)print an object with no indentvoidprint(String s)print a string with no indentvoidprint(String pattern, Object... arguments)Convenience method for calling string.format and printingvoidprintAlignedBlock()Prints the alignedblock without any separators or terminatorsvoidprintlines(String... strings)Print multiple strings, each with a line break.voidprintln()Prints a linebreakvoidprintln(boolean x)print a boolean with no indent with a line breakvoidprintln(char x)print a character with no indent with a line breakvoidprintln(char[] x)print a character array with no indent with a line breakvoidprintln(double x)print a double with no indent with a line breakvoidprintln(float x)print a floating point number with no indent with a line breakvoidprintln(int x)print an integer with no indent with a line breakvoidprintln(int tempIndent, boolean x)Indent the current line and print a boolean on the same line, then print a line breakvoidprintln(int tempIndent, char x)Indent the current line and print a character on the same line, then print a line breakvoidprintln(int tempIndent, char[] x)Indent the current line and print a character array on the same line, then print a line breakvoidprintln(int tempIndent, double x)Indent the current line and print a double on the same line, then print a line breakvoidprintln(int tempIndent, float x)Indent the current line and print a floating point number on the same line, then print a line breakvoidprintln(int tempIndent, int x)Indent the current line and print an integer on the same line, then print a line breakvoidprintln(int tempIndent, long x)Indent the current line and print a long integer on the same line, then print a line breakvoidprintln(int tempIndent, Object x)Indent the current line and print an object on the same line, then print a line breakvoidprintln(int tempIndent, String x)Indent the current line and print a string on the same line, then print a line breakvoidprintln(int indent, String pattern, Object... arguments)Calls string.format, indents and prints with line breakvoidprintln(long x)print a long integer with no indent with a line breakvoidprintln(Object x)print an object with no indent with a line breakvoidprintln(String x)print a string with no indent with a line breakvoidprintln(String pattern, Object... arguments)Convenience method for calling string.format and printing with line breaksvoidprintln(Collection<String> str)Prints all strings in a collection on individual linesvoidsetLinePrefix(String linePrefix)voidsetNoIndent(boolean noIndent)voidsetNoNl(boolean noNl)voidsetoNlCr(boolean oNlCr)voidsetPrintOffsets(boolean printOffsets)voidsetRemoveNl(boolean removeNl)-
Methods inherited from class java.io.PrintStream
append, append, append, checkError, clearError, close, flush, format, format, printf, printf, setError, write, write
-
Methods inherited from class java.io.FilterOutputStream
write
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
IndentedPrintStream
public IndentedPrintStream(OutputStream outputStream)
-
-
Method Detail
-
setPrintOffsets
public void setPrintOffsets(boolean printOffsets)
-
getPrintOffsets
public boolean getPrintOffsets()
-
setLinePrefix
public void setLinePrefix(String linePrefix)
-
getLinePrefix
public String getLinePrefix()
-
align
public void align(Object... s)
Takes an array of strings to be aligned in separate columns, and adds them to the alignedblock
-
printAlignedBlock
public void printAlignedBlock()
Prints the alignedblock without any separators or terminators
-
openBlock
public void openBlock()
prints an open curly bracket and indents the following line
-
closeBlock
public void closeBlock()
Outdents the line and prints a close curly bracket on the following line
-
openBlock
public void openBlock(String s)
Prints a string, an open curly bracket on its own line and indents the following line- Parameters:
s- preceding string
-
closeBlock
public void closeBlock(String s)
Outdents the current line and prints a close curly bracket on the next line, followed by a string- Parameters:
s- succeeding string
-
continueBlock
public void continueBlock(String s)
Ends one block (outdent followed by a close curly bracket on the following line) prints a string on its own line and begins a new block (open curly bracket followed by an indent on the following line- Parameters:
s- intermediate string
-
indent
public void indent()
Increases the indent on the current line
-
outdent
public void outdent()
Decreases the indent on the current line
-
print
public void print(int tempIndent, boolean b)Indent the current line and print a boolean on the same line- Parameters:
tempIndent- magnitude of the indent (number of tab spaces)b- boolean to be printed
-
print
public void print(int tempIndent, char c)Indent the current line and print a character on the same line- Parameters:
tempIndent- magnitude of the indent (number of tab spaces)c- character to be printed
-
print
public void print(int tempIndent, char[] s)Indent the current line and print a character array on the same line- Parameters:
tempIndent- magnitude of the indent (number of tab spaces)s- character array to be printed
-
print
public void print(int tempIndent, double d)Indent the current line and print a double on the same line- Parameters:
tempIndent- magnitude of the indent (number of tab spaces)d- double to be printed
-
print
public void print(int tempIndent, float f)Indent the current line and print a floating point number on the same line- Parameters:
tempIndent- magnitude of the indent (number of tab spaces)f- floating point number to be printed
-
print
public void print(int tempIndent, int i)Indent the current line and print an integer on the same line- Parameters:
tempIndent- magnitude of the indent (number of tab spaces)i- integer to be printed
-
print
public void print(int tempIndent, Object obj)Indent the current line and print an object on the same line- Parameters:
tempIndent- magnitude of the indent (number of tab spaces)obj- object to be printed
-
print
public void print(int tempIndent, String s)Indent the current line and print a string on the same line- Parameters:
tempIndent- magnitude of the indent (number of tab spaces)s- string to be printed
-
print
public void print(int tempIndent, long l)Indent the current line and print a long integer on the same line- Parameters:
tempIndent- magnitude of the indent (number of tab spaces)l- long integer to be printed
-
println
public void println()
Prints a linebreak- Overrides:
printlnin classPrintStream
-
forceNewLine
public void forceNewLine()
Print a linebreak unless we are at the start of a line.
-
println
public void println(int tempIndent, boolean x)Indent the current line and print a boolean on the same line, then print a line break- Parameters:
tempIndent- magnitude of the indent (number of tab spaces)x- boolean to be printed
-
println
public void println(int tempIndent, char x)Indent the current line and print a character on the same line, then print a line break- Parameters:
tempIndent- magnitude of the indent (number of tab spaces)x- character to be printed
-
println
public void println(int tempIndent, char[] x)Indent the current line and print a character array on the same line, then print a line break- Parameters:
tempIndent- magnitude of the indent (number of tab spaces)x- character array to be printed
-
println
public void println(int tempIndent, double x)Indent the current line and print a double on the same line, then print a line break- Parameters:
tempIndent- magnitude of the indent (number of tab spaces)x- double to be printed
-
println
public void println(int tempIndent, float x)Indent the current line and print a floating point number on the same line, then print a line break- Parameters:
tempIndent- magnitude of the indent (number of tab spaces)x- floating point number to be printed
-
println
public void println(int tempIndent, int x)Indent the current line and print an integer on the same line, then print a line break- Parameters:
tempIndent- magnitude of the indent (number of tab spaces)x- integer to be printed
-
println
public void println(int tempIndent, Object x)Indent the current line and print an object on the same line, then print a line break- Parameters:
tempIndent- magnitude of the indent (number of tab spaces)x- object to be printed
-
println
public void println(int tempIndent, String x)Indent the current line and print a string on the same line, then print a line break- Parameters:
tempIndent- magnitude of the indent (number of tab spaces)x- string to be printed
-
println
public void println(int tempIndent, long x)Indent the current line and print a long integer on the same line, then print a line break- Parameters:
tempIndent- magnitude of the indent (number of tab spaces)x- long integer to be printed
-
print
public void print(boolean b)
print a boolean with no indent- Overrides:
printin classPrintStream- Parameters:
b- boolean to print
-
print
public void print(char c)
print a character with no indent- Overrides:
printin classPrintStream- Parameters:
c- character to print
-
print
public void print(char[] s)
print a character array with no indent- Overrides:
printin classPrintStream- Parameters:
s- character array to print
-
print
public void print(double d)
print a double with no indent- Overrides:
printin classPrintStream- Parameters:
d- double to print
-
print
public void print(float f)
print a floating point number with no indent- Overrides:
printin classPrintStream- Parameters:
f- floating point number to print
-
print
public void print(int i)
print an integer with no indent- Overrides:
printin classPrintStream- Parameters:
i- integer to print
-
print
public void print(Object obj)
print an object with no indent- Overrides:
printin classPrintStream- Parameters:
obj- object to print
-
print
public void print(String s)
print a string with no indent- Overrides:
printin classPrintStream- Parameters:
s- string to print
-
print
public void print(long l)
print a long integer with no indent- Overrides:
printin classPrintStream- Parameters:
l- long integer to print
-
println
public void println(boolean x)
print a boolean with no indent with a line break- Overrides:
printlnin classPrintStream- Parameters:
x- boolean to print
-
println
public void println(char x)
print a character with no indent with a line break- Overrides:
printlnin classPrintStream- Parameters:
x- character to print
-
println
public void println(char[] x)
print a character array with no indent with a line break- Overrides:
printlnin classPrintStream- Parameters:
x- character array to print
-
println
public void println(double x)
print a double with no indent with a line break- Overrides:
printlnin classPrintStream- Parameters:
x- double to print
-
println
public void println(float x)
print a floating point number with no indent with a line break- Overrides:
printlnin classPrintStream- Parameters:
x- floating point number to print
-
println
public void println(int x)
print an integer with no indent with a line break- Overrides:
printlnin classPrintStream- Parameters:
x- integer to print
-
println
public void println(Object x)
print an object with no indent with a line break- Overrides:
printlnin classPrintStream- Parameters:
x- object to print
-
println
public void println(String x)
print a string with no indent with a line break- Overrides:
printlnin classPrintStream- Parameters:
x- string to print
-
printlines
public void printlines(String... strings)
Print multiple strings, each with a line break.- Parameters:
strings- multiple strings to print.
-
println
public void println(long x)
print a long integer with no indent with a line break- Overrides:
printlnin classPrintStream- Parameters:
x- long integer to print
-
println
public void println(Collection<String> str)
Prints all strings in a collection on individual lines- Parameters:
str- collection of strings
-
print
public void print(String pattern, Object... arguments)
Convenience method for calling string.format and printing
-
println
public void println(String pattern, Object... arguments)
Convenience method for calling string.format and printing with line breaks
-
print
public void print(int indent, String pattern, Object... arguments)Calls string.format, indents and prints
-
println
public void println(int indent, String pattern, Object... arguments)Calls string.format, indents and prints with line break
-
getOffset
public long getOffset()
-
isoNlCr
public boolean isoNlCr()
-
setoNlCr
public void setoNlCr(boolean oNlCr)
-
isNoIndent
public boolean isNoIndent()
-
setNoIndent
public void setNoIndent(boolean noIndent)
-
isNoNl
public boolean isNoNl()
-
setNoNl
public void setNoNl(boolean noNl)
-
isRemoveNl
public boolean isRemoveNl()
-
setRemoveNl
public void setRemoveNl(boolean removeNl)
-
-