public class StorageHelper extends Object
| Constructor and Description |
|---|
StorageHelper() |
| Modifier and Type | Method and Description |
|---|---|
static <T extends Serializable> |
readFromFile(String filename)
Reads and deserializes the object from the file with the given name.
|
static <T extends Serializable> |
readFromFileSavely(String filename)
Reads and deserializes the object from the file with the given name.
|
static <T extends Serializable> |
readFromStream(InputStream stream)
Reads and deserializes the object from the given stream.
|
static <T extends Serializable> |
readFromStreamSavely(InputStream stream)
Reads and deserializes the object from the given stream.
|
static <T extends Serializable> |
storeToFile(T object,
String filename)
Serializes and stores the given object in the file with the given filename.
|
static <T extends Serializable> |
storeToFileSavely(T object,
String filename)
Serializes and stores the given object in the file with the given filename.
|
static <T extends Serializable> |
storeToStream(T object,
OutputStream out)
Serializes and stores the given object in the given stream.
|
static <T extends Serializable> |
storeToStreamSavely(T object,
OutputStream out)
Serializes and stores the given object in the given stream.
|
public static <T extends Serializable> T readFromFile(String filename) throws IOException, ClassNotFoundException
filename - IOException - if an IO error occursClassNotFoundException - if the class inside the file can't be foundpublic static <T extends Serializable> T readFromStream(InputStream stream) throws IOException, ClassNotFoundException
stream - IOException - if an IO error occursClassNotFoundException - if the class inside the file can't be foundpublic static <T extends Serializable> T readFromFileSavely(String filename)
filename - public static <T extends Serializable> T readFromStreamSavely(InputStream stream)
stream - IOException - if an IO error occursClassNotFoundException - if the class inside the file can't be foundpublic static <T extends Serializable> void storeToFile(T object, String filename) throws IOException
object - filename - IOException - if an IO error occurspublic static <T extends Serializable> void storeToStream(T object, OutputStream out) throws IOException
object - out - IOException - if an IO error occurspublic static <T extends Serializable> boolean storeToFileSavely(T object, String filename)
object - filename - public static <T extends Serializable> boolean storeToStreamSavely(T object, OutputStream out)
object - out - Copyright © 2015–2020. All rights reserved.