org.apache.calcite.avatica.util

## Class Spacer

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

    public class Spacer
    extends Object

Efficiently writes strings of spaces.

### Field Summary

Fields
`private int` `n`

### Constructor Summary

Constructors
Constructor and Description
`Spacer()` Creates a Spacer with zero spaces.
`Spacer(int n)` Creates a Spacer with a given number of spaces.

### Method Summary

All Methods Instance Methods Concrete Methods
`Spacer` `add(int n)` Increases the current number of spaces by `n`.
`int` `get()` Returns the current number of spaces.
`String` `padRight(String string)` Returns a string that is padded on the right with spaces to the current length.
`Spacer` `set(int n)` Sets the current number of spaces.
`StringBuilder` `spaces(StringBuilder buf)` Appends current number of spaces to a `StringBuilder`.
`Spacer` `subtract(int n)` Reduces the current number of spaces by `n`.
`String` `toString()` Returns a string of the current number of spaces.

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

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

### Field Detail

#### n

    private int n

### Constructor Detail

#### Spacer

    public Spacer()

Creates a Spacer with zero spaces.

#### Spacer

    public Spacer(int n)

Creates a Spacer with a given number of spaces.

### Method Detail

#### set

    public Spacer set(int n)

Sets the current number of spaces.

#### get

    public int get()

Returns the current number of spaces.

#### add

    public Spacer add(int n)

Increases the current number of spaces by `n`.

#### subtract

    public Spacer subtract(int n)

Reduces the current number of spaces by `n`.

#### toString

    public String toString()

Returns a string of the current number of spaces.

Overrides:
  `toString` in class `Object`

#### spaces

    public StringBuilder spaces(StringBuilder buf)

Appends current number of spaces to a `StringBuilder`.

#### padRight

    public String padRight(String string)

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