Package org.simpleframework.xml.stream
Class Indenter.Cache
- java.lang.Object
-
- org.simpleframework.xml.stream.Indenter.Cache
-
- Enclosing class:
- Indenter
private static class Indenter.Cache extends java.lang.Object
TheCache
object is used create an indexable list which allows the indenter to quickly acquire an indent using a stack position. This ensures that the indenter need only create an index once for a given stack position. The number of indents held within this cache can also be tracked.
-
-
Constructor Summary
Constructors Constructor Description Cache(int size)
Constructor for theCache
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
get(int index)
This method is used to retrieve an indent from the given position.private void
resize(int size)
Should the number of indents to be cache grows larger than the default initial size then this will increase the size of the cache.void
set(int index, java.lang.String text)
This method is used to add the specified indent on to the cache.int
size()
This method is used to retrieve the number of indents that have been added to the cache.
-
-
-
Method Detail
-
size
public int size()
This method is used to retrieve the number of indents that have been added to the cache. This is used to determine if an indent request is the first.- Returns:
- this returns the number of indents in the cache
-
set
public void set(int index, java.lang.String text)
This method is used to add the specified indent on to the cache. The index allows the cache to act as a stack, when the index is specified it can be used to retrieve the same indent using that index.- Parameters:
index
- this is the position to add the index totext
- this is the indent to add to the position
-
get
public java.lang.String get(int index)
This method is used to retrieve an indent from the given position. This allows the indenter to use the cache as a stack, by increasing and decreasing the index as required.- Parameters:
index
- the position to retrieve the indent from- Returns:
- this is the indent retrieve from the given index
-
resize
private void resize(int size)
Should the number of indents to be cache grows larger than the default initial size then this will increase the size of the cache. This ensures that the indenter can handle an arbitrary number of indents for a given output.- Parameters:
size
- this is the size to expand the cache to
-
-