cz.cuni.amis.utils
Class GenericLoader<T>

java.lang.Object
  extended by cz.cuni.amis.utils.GenericLoader<T>

public class GenericLoader<T>
extends java.lang.Object


Constructor Summary
GenericLoader()
           
 
Method Summary
 T loadObject(java.io.File file)
          Loads the object of type T from file 'file'.
 T loadObject(java.io.InputStream in)
          Loads the object of type T from input stream.
 T loadObject(java.lang.String pathAndFileName)
          Loads the object of type T from the file at path 'pathAndFileName'.
 boolean saveObject(T object, java.io.File file)
          Writes object to the file;
 boolean saveObject(T object, java.io.ObjectOutputStream out)
          Writes object to the output stream, returns success
 boolean saveObject(T object, java.io.OutputStream out)
          Writes object to the output stream, returns success.
 boolean saveObject(T object, java.lang.String pathAndFileName)
          Writes object to the file at 'pathAndFileName';
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericLoader

public GenericLoader()
Method Detail

loadObject

public T loadObject(java.io.InputStream in)
Loads the object of type T from input stream.

Parameters:
in -
Returns:
null (failure) || loaded object

loadObject

public T loadObject(java.io.File file)
Loads the object of type T from file 'file'.

Parameters:
file -
Returns:
null (failure) || loaded object

loadObject

public T loadObject(java.lang.String pathAndFileName)
Loads the object of type T from the file at path 'pathAndFileName'.

Parameters:
pathAndFileName -
Returns:
null (failure) || loaded object

saveObject

public boolean saveObject(T object,
                          java.io.ObjectOutputStream out)
Writes object to the output stream, returns success

Parameters:
object -
out -
Returns:
success

saveObject

public boolean saveObject(T object,
                          java.io.OutputStream out)
Writes object to the output stream, returns success.

Parameters:
object -
out -
Returns:
success

saveObject

public boolean saveObject(T object,
                          java.io.File file)
Writes object to the file;

Parameters:
object -
file -
Returns:
success

saveObject

public boolean saveObject(T object,
                          java.lang.String pathAndFileName)
Writes object to the file at 'pathAndFileName';

Parameters:
object -
pathAndFileName -
Returns:
success