public class OutOfHeapTemporaryStorage extends Object
Usage: For each object to be stored, firstly a "container" is created and then data is appended/written to the container. In this way, it's possible for an XML SAX parser, finding an XML [myObject type="x"] tag, to create the container and place it in the appropriate place in the destination data structure (e.g. if its place dependent on the element's attribute), but for the container to be actually filled with data while processing further tags, e.g. child elements of the original tag.
OutOfHeapTemporaryFileStorage file = new OutOfHeapTemporaryFileStorage(); // file created in /tmp
// Persisting and loading a string
OutOfHeapString str = file.newStringContainer();
str.append("xyz");
System.out.println("str is: " + str.toString()); // fetches string from file
// Persisting and loading chunks of XML
org.w3c.dom.Element anElement = ....;
OutOfHeapXml xml = file.newXmlContainer();
xml.setXml(anElement); // call only once
org.w3c.dom.Element afterLoading = x.toXmlDomElement();
| Modifier and Type | Class and Description |
|---|---|
class |
OutOfHeapTemporaryStorage.OutOfHeapString |
class |
OutOfHeapTemporaryStorage.OutOfHeapXml |
| Constructor and Description |
|---|
OutOfHeapTemporaryStorage() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
appendToString(OutOfHeapTemporaryStorage.OutOfHeapString s,
String suffix) |
OutOfHeapTemporaryStorage.OutOfHeapString |
newStringContainer()
Returns a new string container for the empty string
|
OutOfHeapTemporaryStorage.OutOfHeapString |
newStringContainer(String initialValue) |
OutOfHeapTemporaryStorage.OutOfHeapXml |
newXmlContainer() |
protected String |
readString(OutOfHeapTemporaryStorage.OutOfHeapString s) |
protected Element |
readXml(OutOfHeapTemporaryStorage.OutOfHeapXml inFile) |
protected void |
writeXml(OutOfHeapTemporaryStorage.OutOfHeapXml xml,
Element element) |
public OutOfHeapTemporaryStorage.OutOfHeapString newStringContainer()
public OutOfHeapTemporaryStorage.OutOfHeapString newStringContainer(String initialValue)
protected void appendToString(OutOfHeapTemporaryStorage.OutOfHeapString s, String suffix)
protected String readString(OutOfHeapTemporaryStorage.OutOfHeapString s)
public OutOfHeapTemporaryStorage.OutOfHeapXml newXmlContainer()
protected void writeXml(OutOfHeapTemporaryStorage.OutOfHeapXml xml, Element element)
protected Element readXml(OutOfHeapTemporaryStorage.OutOfHeapXml inFile)
Copyright © 2003–2018. All rights reserved.