public class Spaces extends Object
| Modifier and Type | Class and Description |
|---|---|
private static class |
Spaces.SpaceList
List whose
ith entry is a string consisting of i spaces. |
private static class |
Spaces.SpaceString
A string of spaces.
|
| Modifier and Type | Field and Description |
|---|---|
static CharSequence |
MAX
The longest possible string of spaces.
|
private static List<String> |
SPACE_LIST
It doesn't look like this list is ever updated.
|
| Modifier | Constructor and Description |
|---|---|
private |
Spaces() |
| Modifier and Type | Method and Description |
|---|---|
static Appendable |
append(Appendable buf,
int n)
Appends
n spaces to an Appendable. |
static PrintWriter |
append(PrintWriter pw,
int n)
Appends
n spaces to a PrintWriter. |
static StringBuffer |
append(StringBuffer buf,
int n)
Appends
n spaces to a StringBuffer. |
static StringBuilder |
append(StringBuilder buf,
int n)
Appends
n spaces to a StringBuilder. |
static StringWriter |
append(StringWriter pw,
int n)
Appends
n spaces to a StringWriter. |
static String |
of(int n)
Returns a string of
n spaces. |
static String |
padLeft(String string,
int n)
Returns a string that is padded on the left with spaces to the given
length.
|
static String |
padRight(String string,
int n)
Returns a string that is padded on the right with spaces to the given
length.
|
static CharSequence |
sequence(int n)
Creates a sequence of
n spaces. |
private static final List<String> SPACE_LIST
Spaces.SpaceList.get(int) causes an IndexOutOfBoundsException.public static final CharSequence MAX
Use with StringBuilder.append(CharSequence, int, int) to
append spaces without doing memory allocation.
public static CharSequence sequence(int n)
n spaces.public static String of(int n)
n spaces.public static Appendable append(Appendable buf, int n) throws IOException
n spaces to an Appendable.IOExceptionpublic static PrintWriter append(PrintWriter pw, int n)
n spaces to a PrintWriter.public static StringWriter append(StringWriter pw, int n)
n spaces to a StringWriter.public static StringBuilder append(StringBuilder buf, int n)
n spaces to a StringBuilder.public static StringBuffer append(StringBuffer buf, int n)
n spaces to a StringBuffer.public static String padRight(String string, int n)
Copyright © 2012–2016 The Apache Software Foundation. All rights reserved.