Package org.qdl_lang.state
Class StateUtils
- java.lang.Object
-
- org.qdl_lang.state.StateUtils
-
public abstract class StateUtils extends Object
Created by Jeff Gaynor
on 2/6/20 at 1:33 PM
-
-
Field Summary
Fields Modifier and Type Field Description protected static StateUtilsfactory
-
Constructor Summary
Constructors Constructor Description StateUtils()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static Stateclone(State state)Take the current state and make a complete copy of it.abstract Statecreate()static StateUtilsgetFactory()static booleanisFactorySet()static StatejavaClone(State state)static Stateload(InputStream inputStream)See note onload(State, XMLEventReader)static Stateload(XMLEventReader xer)static Stateload(State state, XMLEventReader xer)Read in the state from an even reader.static Stateload(State state, SerializationState SerializationState, XMLEventReader xer)static Stateloadb64(String encodedState)Deserialize the state from a base 64 encoded string.static ObjectloadObject(InputStream inputStream)static voidmain(String[] args)static StatenewInstance()static voidsave(State state, OutputStream outputStream)Serialize the Sate object to the given output stream.static Stringsaveb64(State state)Serialize the state to a base 64 encoded string.static voidsaveObject(Object object, OutputStream outputStream)static voidsetFactory(StateUtils f)static intsize(State state)
-
-
-
Field Detail
-
factory
protected static StateUtils factory
-
-
Method Detail
-
clone
public static State clone(State state)
Take the current state and make a complete copy of it. Note this serialized then deserializes it.- Parameters:
state-- Returns:
- Throws:
IOExceptionClassNotFoundException
-
javaClone
public static State javaClone(State state) throws IOException, ClassNotFoundException
- Throws:
IOExceptionClassNotFoundException
-
size
public static int size(State state)
-
save
public static void save(State state, OutputStream outputStream) throws IOException
Serialize the Sate object to the given output stream.- Parameters:
state-outputStream-- Throws:
IOException
-
saveObject
public static void saveObject(Object object, OutputStream outputStream) throws IOException
- Throws:
IOException
-
saveb64
public static String saveb64(State state) throws IOException
Serialize the state to a base 64 encoded string.- Parameters:
state-- Returns:
- Throws:
IOException
-
loadb64
public static State loadb64(String encodedState) throws IOException, ClassNotFoundException
Deserialize the state from a base 64 encoded string.- Parameters:
encodedState-- Returns:
- Throws:
IOExceptionClassNotFoundException
-
loadObject
public static Object loadObject(InputStream inputStream) throws IOException, ClassNotFoundException
- Throws:
IOExceptionClassNotFoundException
-
load
public static State load(InputStream inputStream) throws IOException, ClassNotFoundException
See note onload(State, XMLEventReader)- Parameters:
inputStream-- Returns:
- Throws:
IOExceptionClassNotFoundException
-
load
public static State load(State state, XMLEventReader xer) throws XMLStreamException
Read in the state from an even reader. Notes that this is used in cases where there is no workspace, such as in scripts, but there is a (possibly custom) state object that needs to be populated.- Parameters:
state-xer-- Returns:
- Throws:
XMLStreamException
-
load
public static State load(State state, SerializationState SerializationState, XMLEventReader xer) throws XMLStreamException
- Throws:
XMLStreamException
-
load
public static State load(XMLEventReader xer) throws XMLStreamException
- Throws:
XMLStreamException
-
newInstance
public static State newInstance()
-
main
public static void main(String[] args)
-
create
public abstract State create()
-
isFactorySet
public static boolean isFactorySet()
-
getFactory
public static StateUtils getFactory()
-
setFactory
public static void setFactory(StateUtils f)
-
-