Package 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.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final CharSequence`
`MAX`
The longest possible string of spaces.

## Method Summary

Modifier and Type
Method
Description
`static PrintWriter`
`append(PrintWriter pw, int n)`
Appends `n` spaces to a `PrintWriter`.
`static StringWriter`
`append(StringWriter pw, int n)`
Appends `n` spaces to a `StringWriter`.
`static Appendable`
`append(Appendable buf, int n)`
Appends `n` spaces to an `Appendable`.
`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 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 Details

### 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.

## Method Details

### 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.