ElementType
- The element type to be saved and loadedpublic class ElementFileStream<ElementType>
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
ElementFileStream(ElementType element,
java.lang.String route)
Creates a new ElementFileStream
|
ElementFileStream(java.lang.String route)
Creates a new ElementFileStream
|
Modifier and Type | Method and Description |
---|---|
ElementType |
getElement()
Gets the element to be loaded
|
ElementType |
loadElement()
Loads and returns the element loaded
|
void |
saveElement()
Saves the element
|
void |
setElement(ElementType element)
Sets the element to be saved
|
void |
setFile(java.lang.String fileRoute)
Sets the file where the current element will be saved on
|
public ElementFileStream(ElementType element, java.lang.String route)
element
- the element to be saved by this instanceroute
- the file route of the file where this instance will save the
elementjava.lang.NullPointerException
- if route or element argument are nullpublic ElementFileStream(java.lang.String route) throws java.lang.NullPointerException
route
- the file route of the file where this instance will save the
elementjava.lang.NullPointerException
- if route argument is nullpublic void setFile(java.lang.String fileRoute) throws java.lang.NullPointerException
fileRoute
- the output file routejava.lang.NullPointerException
- if fileRoute argument is nullpublic void saveElement() throws java.io.IOException
java.io.IOException
- if the element couldn't be properly writtenpublic ElementType getElement()
public void setElement(ElementType element)
element
- the simulator to be savedpublic ElementType loadElement() throws java.io.IOException
java.io.IOException
- if the element couldn't be loaded