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 StateUtils
factory
-
Constructor Summary
Constructors Constructor Description StateUtils()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static State
clone(State state)
Take the current state and make a complete copy of it.abstract State
create()
static StateUtils
getFactory()
static boolean
isFactorySet()
static State
javaClone(State state)
static State
load(InputStream inputStream)
See note onload(State, XMLEventReader)
static State
load(XMLEventReader xer)
static State
load(State state, XMLEventReader xer)
Read in the state from an even reader.static State
load(State state, SerializationState SerializationState, XMLEventReader xer)
static State
loadb64(String encodedState)
Deserialize the state from a base 64 encoded string.static Object
loadObject(InputStream inputStream)
static void
main(String[] args)
static State
newInstance()
static void
save(State state, OutputStream outputStream)
Serialize the Sate object to the given output stream.static String
saveb64(State state)
Serialize the state to a base 64 encoded string.static void
saveObject(Object object, OutputStream outputStream)
static void
setFactory(StateUtils f)
static int
size(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:
IOException
ClassNotFoundException
-
javaClone
public static State javaClone(State state) throws IOException, ClassNotFoundException
- Throws:
IOException
ClassNotFoundException
-
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:
IOException
ClassNotFoundException
-
loadObject
public static Object loadObject(InputStream inputStream) throws IOException, ClassNotFoundException
- Throws:
IOException
ClassNotFoundException
-
load
public static State load(InputStream inputStream) throws IOException, ClassNotFoundException
See note onload(State, XMLEventReader)
- Parameters:
inputStream
-- Returns:
- Throws:
IOException
ClassNotFoundException
-
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)
-
-