Java Utililty Methods ObjectOutputStream Write

List of utility methods to do ObjectOutputStream Write

  1. HOME
  2. Java
  3. O
  4. ObjectOutputStream Write

Description

The list of methods to do ObjectOutputStream Write are organized into topic(s).

Method

Object load(File f)
Deserialize the contents of File f and return the resulting object
ObjectInputStream in = 
 new ObjectInputStream(new FileInputStream(f));
return in.readObject();
Object load(File file)
load
Object o = null;
try {
 ObjectInputStream s = new ObjectInputStream(new FileInputStream(file));
 o = s.readObject();
 s.close();
} catch (IOException | ClassNotFoundException e) {
 e.printStackTrace();
return o;
Object load(File file)
load
FileInputStream fis = null;
ObjectInputStream ois = null;
try {
 fis = new FileInputStream(file);
 ois = new ObjectInputStream(fis);
 return ois.readObject();
} finally {
 try {
...
T load(File file, Class type)
Loads a serialized object of the specifed type from the file.
try {
 FileInputStream fis = new FileInputStream(file);
 ObjectInputStream inStream = new ObjectInputStream(new BufferedInputStream(fis));
 T object = type.cast(inStream.readObject());
 inStream.close();
 return object;
} catch (IOException ioe) {
 throw new IOError(ioe);
...
Object load(File file, final ClassLoader... loaders)
load
try {
 InputStream fis = new FileInputStream(file);
 if (file.getName().endsWith(".gz"))
 fis = new GZIPInputStream(fis);
 ObjectInputStream oIn = new ObjectInputStream(fis) {
 @Override
 protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
 String className = desc.getName();
...
T load(String fileName)
load
try {
 FileInputStream fileIn = new FileInputStream(fileName);
 ObjectInputStream in = new ObjectInputStream(fileIn);
 T obj = (T) in.readObject();
 in.close();
 fileIn.close();
 return obj;
} catch (IOException | ClassNotFoundException e) {
...
Object load(String filename)
load
return load(new File(filename));
Result load(String name, Class resultClass)
Load data of type resultClass from the File called by the given name.dat.
try {
 InputStream file = new FileInputStream(getFile(name));
 InputStream buffer = new BufferedInputStream(file);
 try (ObjectInput input = new ObjectInputStream(buffer)) {
 return resultClass.cast(input.readObject());
} catch (ClassNotFoundException | IOException ignored) {
return null;
Object load(String path)
Loads an Object from a File
Object result;
try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream(path))) {
 result = ois.readObject();
return result;
Object loadAllPlaying(String path)
Used for loading the ParkourSessions.
Object result = null;
try {
 ObjectInputStream ois = new ObjectInputStream(new FileInputStream(path));
 result = ois.readObject();
 ois.close();
} catch (Exception ex) {
 ex.printStackTrace();
return result;


AltStyle によって変換されたページ (->オリジナル) /