Package org.apache.calcite.avatica.util
Class Spaces
- java.lang.Object
-
- org.apache.calcite.avatica.util.Spaces
-
public class Spaces extends java.lang.ObjectUtilities for creating strings of spaces.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classSpaces.SpaceListList whoseith entry is a string consisting ofispaces.private static classSpaces.SpaceStringA string of spaces.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.CharSequenceMAXThe longest possible string of spaces.private static java.util.List<java.lang.String>SPACE_LISTIt doesn't look like this list is ever updated.
-
Constructor Summary
Constructors Modifier Constructor Description privateSpaces()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.io.PrintWriterappend(java.io.PrintWriter pw, int n)Appendsnspaces to aPrintWriter.static java.io.StringWriterappend(java.io.StringWriter pw, int n)Appendsnspaces to aStringWriter.static java.lang.Appendableappend(java.lang.Appendable buf, int n)Appendsnspaces to anAppendable.static java.lang.StringBufferappend(java.lang.StringBuffer buf, int n)Appendsnspaces to aStringBuffer.static java.lang.StringBuilderappend(java.lang.StringBuilder buf, int n)Appendsnspaces to aStringBuilder.static java.lang.Stringof(int n)Returns a string ofnspaces.static java.lang.StringpadLeft(java.lang.String string, int n)Returns a string that is padded on the left with spaces to the given length.static java.lang.StringpadRight(java.lang.String string, int n)Returns a string that is padded on the right with spaces to the given length.static java.lang.CharSequencesequence(int n)Creates a sequence ofnspaces.
-
-
-
Field Detail
-
SPACE_LIST
private static final java.util.List<java.lang.String> SPACE_LIST
It doesn't look like this list is ever updated. But it is - when a call to toSpaces.SpaceList.get(int)causes anIndexOutOfBoundsException.
-
MAX
public static final java.lang.CharSequence MAX
The longest possible string of spaces. Fine as long as you don't try to print it.Use with
StringBuilder.append(CharSequence, int, int)to append spaces without doing memory allocation.
-
-
Method Detail
-
sequence
public static java.lang.CharSequence sequence(int n)
Creates a sequence ofnspaces.
-
of
public static java.lang.String of(int n)
Returns a string ofnspaces.
-
append
public static java.lang.Appendable append(java.lang.Appendable buf, int n) throws java.io.IOExceptionAppendsnspaces to anAppendable.- Throws:
java.io.IOException
-
append
public static java.io.PrintWriter append(java.io.PrintWriter pw, int n)Appendsnspaces to aPrintWriter.
-
append
public static java.io.StringWriter append(java.io.StringWriter pw, int n)Appendsnspaces to aStringWriter.
-
append
public static java.lang.StringBuilder append(java.lang.StringBuilder buf, int n)Appendsnspaces to aStringBuilder.
-
append
public static java.lang.StringBuffer append(java.lang.StringBuffer buf, int n)Appendsnspaces to aStringBuffer.
-
padRight
public static java.lang.String padRight(java.lang.String string, int n)Returns a string that is padded on the right with spaces to the given length.
-
padLeft
public static java.lang.String padLeft(java.lang.String string, int n)Returns a string that is padded on the left with spaces to the given length.
-
-