ALox  V. 2402 R. 0
Home ALox for C++ ALox for C# ALox for Java Download
Public Static Methods | Private Static Fields | List of all members
Spaces Class Reference
Collaboration diagram for Spaces:
[legend]

Class Description


This is a simple class that provides a string full of spaces. This may be used to avoid memory allocations/initializations.

Public Static Methods

static AString get ()
 
static AString get (int minSize)
 
static void write (PrintStream os, int qty)
 
static void write (Writer os, int qty)
 

Private Static Fields

static byte[] spacesByte
 
static AString theSpaces =new AString()
 

Member Function Documentation

◆ get() [1/2]

static AString get ( )
static

Overloaded version of get(int) providing default parameter 128. It is recommended to generally use this method instead of the parameterized.

Returns
A const AString filled with spaces.

◆ get() [2/2]

static AString get ( int  minSize)
static

Receives an AString full of spaces. The AString returned must not be altered.

Attention
Parameter minSize should be omitted and the size of the object returned accepted. Requesting a higher size, might result in slightly more efficiency. In multithreaded processes, changing the size must be performed during bootstrap, e.g. directly after invoking ALIB.init by calling this method with the appropriate size.
Parameters
minSizeThe minimum number of spaces that should be available in the returned AString. Defaults to 128. See notes in method description!
Returns
A const AString filled with spaces.

◆ write() [1/2]

static void write ( PrintStream  os,
int  qty 
)
static

Write the given number of spaces to a PrintStream.

Parameters
osThe output stream to write to
qtyThe quantity of spaces to write

◆ write() [2/2]

static void write ( Writer  os,
int  qty 
)
static

Write the given number of spaces to a Writer.

Parameters
osThe output stream to write to
qtyThe quantity of spaces to write

Member Data Documentation

◆ spacesByte

byte [] spacesByte
staticprivate

A fixed size byte array of spaces used in write(PrintStream, int). Unfortunately, Java does not provide a method in PrintStream to write a portion of a character array, therefore this is fixed (and redundant to field theSpaces).

◆ theSpaces

AString theSpaces =new AString()
staticprivate

The internal string of spaces returned by get and used by write.


The documentation for this class was generated from the following file: