org.apache.calcite.avatica.util

## Class Spaces

- java.lang.Object
- - org.apache.calcite.avatica.util.Spaces

    public class Spaces
    extends Object

Utilities for creating strings of spaces.

### Nested Class Summary

Nested Classes
`private static class` `Spaces.SpaceList` List whose `i`th entry is a string consisting of `i` spaces.
`private static class` `Spaces.SpaceString` A string of spaces.

### Field Summary

Fields
`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.

### Constructor Summary

Constructors
`private` `Spaces()`

### Method Summary

All Methods Static Methods Concrete Methods
`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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### SPACE_LIST

    private static final List<String> SPACE_LIST

It doesn't look like this list is ever updated. But it is - when a call to to `Spaces.SpaceList.get(int)` causes an `IndexOutOfBoundsException`.

#### MAX

    public static final 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.

### Constructor Detail

#### Spaces

    private Spaces()

### Method Detail

#### sequence

    public static CharSequence sequence(int n)

Creates a sequence of `n` spaces.

#### of

    public static String of(int n)

Returns a string of `n` spaces.

#### append

    public static Appendable append(Appendable buf,
                                    int n)
                             throws IOException

Appends `n` spaces to an `Appendable`.

Throws:
  `IOException`

#### append

    public static PrintWriter append(PrintWriter pw,
                                     int n)

Appends `n` spaces to a `PrintWriter`.

#### append

    public static StringWriter append(StringWriter pw,
                                      int n)

Appends `n` spaces to a `StringWriter`.

#### append

    public static StringBuilder append(StringBuilder buf,
                                       int n)

Appends `n` spaces to a `StringBuilder`.

#### append

    public static StringBuffer append(StringBuffer buf,
                                      int n)

Appends `n` spaces to a `StringBuffer`.

#### padRight

    public static String padRight(String string,
                                  int n)

Returns a string that is padded on the right with spaces to the given length.

#### padLeft

    public static String padLeft(String string,
                                 int n)

Returns a string that is padded on the left with spaces to the given length.