org.openide.util.io.NbMarshalledObject m = new org.openide.util.io.NbMarshalledObject(this); return (ServiceType) m.get(); } catch (IOException ex) { anEx = ex;
/** * added for future use - convert NbMarshalledObject to primitive data types and other supported types (if possible) */ static Object unMarshallObjectRecursively(Object mo) { Object o = mo; while (o instanceof NbMarshalledObject) { try { o = ((NbMarshalledObject) o).get(); } catch (IOException e) { ExternalUtil.exception(e); return mo; } catch (ClassNotFoundException e) { ExternalUtil.exception(e); return mo; } } return (o == null) ? mo : o; }
/** Saves pool to stream by saving all filesystems. * The default (system) filesystem, or any persistent filesystems, are skipped. * * @param oos object output stream * @exception IOException if an error occures * @deprecated Unused. */ @Deprecated public final synchronized void writeExternal(ObjectOutput oos) throws IOException { Iterator iter = fileSystems.iterator(); while (iter.hasNext()) { FileSystem fs = (FileSystem) iter.next(); if (!fs.isDefault() && !fs.isPersistent()) { oos.writeObject(new NbMarshalledObject(fs)); } } oos.writeObject(null); }
try { NbMarshalledObject mar = (NbMarshalledObject) obj; fs = (FileSystem) mar.get(); } catch (IOException ex) { ExternalUtil.exception(ex);
/** Reads external. */ public void readExternal(ObjectInput oi) throws IOException, ClassNotFoundException { for (;;) { String file = (String) oi.readObject(); if (file == null) { break; } for (;;) { String attr = (String) oi.readObject(); if (attr == null) { break; } Object o = oi.readObject(); // backward compatibility if (o instanceof java.rmi.MarshalledObject) { o = ((java.rmi.MarshalledObject) o).get(); o = new NbMarshalledObject(o); } // end of backward compatibility if (o instanceof NbMarshalledObject) { setAttr(file, attr, o); } } } } }
org.openide.util.io.NbMarshalledObject m = new org.openide.util.io.NbMarshalledObject(this); return (ServiceType) m.get(); } catch (IOException ex) { anEx = ex;
return (mo == null) ? null : mo.get(); } catch (IOException e) { ExternalUtil.log("Cannot load attribute " + attrName + " from " + fileName); // NOI18N
/** Stores the manager */ public void writeExternal (ObjectOutput oo) throws IOException { super.writeExternal (oo); oo.writeObject (new NbMarshalledObject (manager)); }
/** Called from {@link #clone} to actually create a new component from this one. * The default implementation only clones the object by calling {@link Object#clone}. * Subclasses may leave this as is, assuming they have no special needs for the cloned * data besides copying it from one object to the other. If they do, the superclass * method should be called, and the returned object modified appropriately. * @return a copy of this object */ protected CloneableTopComponent createClonedObject () { try { // clones the component using serialization NbMarshalledObject o = new NbMarshalledObject (this); CloneableTopComponent top = (CloneableTopComponent)o.get (); return top; } catch (IOException ex) { ex.printStackTrace(); throw new InternalError (); } catch (ClassNotFoundException ex) { ex.printStackTrace(); throw new InternalError (); } }
/** Read the object. */ private void readObject (ObjectInputStream oos) throws IOException, ClassNotFoundException { final LinkedList<ServiceType> ll = new LinkedList<ServiceType> (); for (;;) { NbMarshalledObject obj = (NbMarshalledObject) oos.readObject(); if (obj == null) { break; } try { ServiceType s = (ServiceType) obj.get(); ll.add(s); } catch (IOException ex) { Logger.getLogger(Services.class.getName()).log(Level.WARNING, null, ex); } catch (ClassNotFoundException ex) { Logger.getLogger(Services.class.getName()).log(Level.WARNING, null, ex); } } getDefault ().setServiceTypes (ll); }
/** Stores the manager */ public void writeExternal (ObjectOutput oo) throws IOException { super.writeExternal (oo); oo.writeObject (new NbMarshalledObject (manager)); }
/** Called from {@link #clone} to actually create a new component from this one. * The default implementation only clones the object by calling {@link Object#clone}. * Subclasses may leave this as is, assuming they have no special needs for the cloned * data besides copying it from one object to the other. If they do, the superclass * method should be called, and the returned object modified appropriately. * @return a copy of this object */ protected CloneableTopComponent createClonedObject () { try { // clones the component using serialization NbMarshalledObject o = new NbMarshalledObject (this); CloneableTopComponent top = (CloneableTopComponent)o.get (); return top; } catch (IOException ex) { ex.printStackTrace(); throw new InternalError (); } catch (ClassNotFoundException ex) { ex.printStackTrace(); throw new InternalError (); } }
/** * added for future use - convert NbMarshalledObject to primitive data types and other supported types (if possible) */ static Object unMarshallObjectRecursively(Object mo) { Object o = mo; while(o instanceof NbMarshalledObject) { try { o = ((NbMarshalledObject)o).get (); } catch (IOException e) { ExternalUtil.exception (e); return mo; } catch (ClassNotFoundException e) { ExternalUtil.exception (e); return mo; } } return (o == null)? mo : o; }
/** Write the object down. */ private void writeObject (ObjectOutputStream oos) throws IOException { Enumeration en = services (); while (en.hasMoreElements ()) { ServiceType s = (ServiceType)en.nextElement (); NbMarshalledObject obj; try { obj = new NbMarshalledObject (s); } catch (IOException ex) { Logger.getLogger(Services.class.getName()).log(Level.WARNING, null, ex); // skip the object if it cannot be serialized obj = null; } if (obj != null) { oos.writeObject (obj); } } oos.writeObject (null); }
org.openide.util.io.NbMarshalledObject m = new org.openide.util.io.NbMarshalledObject(this); return (ServiceType) m.get(); } catch (IOException ex) { anEx = ex;
/** * added for future use - convert NbMarshalledObject to primitive data types and other supported types (if possible) */ static Object unMarshallObjectRecursively(Object mo) { Object o = mo; while(o instanceof NbMarshalledObject) { try { o = ((NbMarshalledObject)o).get (); } catch (IOException e) { ExternalUtil.exception (e); return mo; } catch (ClassNotFoundException e) { ExternalUtil.exception (e); return mo; } } return (o == null)? mo : o; }
/** Saves pool to stream by saving all filesystems. * The default (system) filesystem, or any persistent filesystems, are skipped. * * @param oos object output stream * @exception IOException if an error occures * @deprecated Unused. */ public final synchronized void writeExternal (ObjectOutput oos) throws IOException { Iterator iter = fileSystems.iterator(); while (iter.hasNext()) { FileSystem fs = (FileSystem)iter.next(); if (!fs.isDefault () && !fs.isPersistent ()) { oos.writeObject (new NbMarshalledObject (fs)); } } oos.writeObject (null); }
org.openide.util.io.NbMarshalledObject m = new org.openide.util.io.NbMarshalledObject(this); return (ServiceType) m.get(); } catch (IOException ex) { anEx = ex;
/** Saves pool to stream by saving all filesystems. * The default (system) filesystem, or any persistent filesystems, are skipped. * * @param oos object output stream * @exception IOException if an error occures * @deprecated Unused. */ public final synchronized void writeExternal (ObjectOutput oos) throws IOException { Iterator iter = fileSystems.iterator(); while (iter.hasNext()) { FileSystem fs = (FileSystem)iter.next(); if (!fs.isDefault () && !fs.isPersistent ()) { oos.writeObject (new NbMarshalledObject (fs)); } } oos.writeObject (null); }