ObjectInputStream ois = new NbObjectInputStream(bin);
ObjectInputStream ois = new NbObjectInputStream(bis); Object ret = ois.readObject();
/** Reads an object from the given object input. * The object had to be saved by the {@link NbObjectOutputStream#writeSafely} method. * * @param oi object input * @return the read object * @exception IOException if IO error occured * @exception SafeException if the operation failed but the stream is ok * for further reading */ public static Object readSafely(ObjectInput oi) throws IOException { int size = oi.readInt(); byte[] byteArray = new byte[size]; oi.readFully(byteArray, 0, size); try { ByteArrayInputStream bis = new ByteArrayInputStream(byteArray); NbObjectInputStream ois = new NbObjectInputStream(bis); Object obj = ois.readObject(); bis.close(); return obj; } catch (Exception exc) { // encapsulate all exceptions into safe exception throw new SafeException(exc); } catch (LinkageError le) { throw new SafeException(new InvocationTargetException(le)); } }
ObjectInputStream ois = new org.openide.util.io.NbObjectInputStream(fis); Object o = ois.readObject();
ObjectInputStream ois = new NbObjectInputStream(bin);
ObjectInputStream ois = new NbObjectInputStream(bin);
public FieldTask loadTask(FileObject fileObject) { LOGGER.log(Level.FINEST, "loading FieldTask object from file {0}", fileObject.getName()); assert FieldTask.EXT.equals(fileObject.getExt()) : "Can only load FieldTasks"; Object object = null; // use of NbObjectInputStream is needed because FieldTask has members from a different module // noramel ObjectInputStream uses the module classloader and is not able to see those classes try (ObjectInputStream ois = new NbObjectInputStream(fileObject.getInputStream())) { object = ois.readObject(); } catch (ClassNotFoundException | IOException ex) { Exceptions.printStackTrace(ex); LOGGER.log(Level.SEVERE, "Could not load file {0} with the exception {1}", new Object[]{fileObject, ex}); throw new RuntimeException(ex); } assert object instanceof FieldTask : "FileObject did not contain the right type (FieldTask) but a " + object.getClass(); FieldTask fieldTask = (FieldTask) object; return getCachedInstanceFor(fieldTask); }
ObjectInputStream ois = new NbObjectInputStream (bin); try { return ois.readObject ();
ObjectInputStream ois = new NbObjectInputStream(bis); Object ret = ois.readObject(); return ret;
ObjectInputStream ois = new NbObjectInputStream(bis); Object ret = ois.readObject(); return ret;
ObjectInputStream ois = new NbObjectInputStream (bin); try { return ois.readObject ();
/** Reads an object from the given object input. * The object had to be saved by the {@link NbObjectOutputStream#writeSafely} method. * * @param oi object input * @return the read object * @exception IOException if IO error occured * @exception SafeException if the operation failed but the stream is ok * for further reading */ public static Object readSafely (ObjectInput oi) throws IOException { int size = oi.readInt (); byte[] byteArray = new byte [size]; oi.readFully (byteArray, 0, size); try { ByteArrayInputStream bis = new ByteArrayInputStream (byteArray); NbObjectInputStream ois = new NbObjectInputStream (bis); Object obj = ois.readObject (); bis.close (); return obj; } catch (Exception exc) { // encapsulate all exceptions into safe exception throw new SafeException (exc); } catch (LinkageError le) { throw new SafeException (new InvocationTargetException (le)); } }
/** Reads an object from the given object input. * The object had to be saved by the {@link NbObjectOutputStream#writeSafely} method. * * @param oi object input * @return the read object * @exception IOException if IO error occured * @exception SafeException if the operation failed but the stream is ok * for further reading */ public static Object readSafely(ObjectInput oi) throws IOException { int size = oi.readInt(); byte[] byteArray = new byte[size]; oi.readFully(byteArray, 0, size); try { ByteArrayInputStream bis = new ByteArrayInputStream(byteArray); NbObjectInputStream ois = new NbObjectInputStream(bis); Object obj = ois.readObject(); bis.close(); return obj; } catch (Exception exc) { // encapsulate all exceptions into safe exception throw new SafeException(exc); } catch (LinkageError le) { throw new SafeException(new InvocationTargetException(le)); } }
/** Reads an object from the given object input. * The object had to be saved by the {@link NbObjectOutputStream#writeSafely} method. * * @param oi object input * @return the read object * @exception IOException if IO error occured * @exception SafeException if the operation failed but the stream is ok * for further reading */ public static Object readSafely(ObjectInput oi) throws IOException { int size = oi.readInt(); byte[] byteArray = new byte[size]; oi.readFully(byteArray, 0, size); try { ByteArrayInputStream bis = new ByteArrayInputStream(byteArray); NbObjectInputStream ois = new NbObjectInputStream(bis); Object obj = ois.readObject(); bis.close(); return obj; } catch (Exception exc) { // encapsulate all exceptions into safe exception throw new SafeException(exc); } catch (LinkageError le) { throw new SafeException(new InvocationTargetException(le)); } }
/** Reads an object from the given object input. * The object had to be saved by the {@link NbObjectOutputStream#writeSafely} method. * * @param oi object input * @return the read object * @exception IOException if IO error occured * @exception SafeException if the operation failed but the stream is ok * for further reading */ public static Object readSafely (ObjectInput oi) throws IOException { int size = oi.readInt (); byte[] byteArray = new byte [size]; oi.readFully (byteArray, 0, size); try { ByteArrayInputStream bis = new ByteArrayInputStream (byteArray); NbObjectInputStream ois = new NbObjectInputStream (bis); Object obj = ois.readObject (); bis.close (); return obj; } catch (Exception exc) { // encapsulate all exceptions into safe exception throw new SafeException (exc); } catch (LinkageError le) { throw new SafeException (new InvocationTargetException (le)); } }
ObjectInputStream ois = new org.openide.util.io.NbObjectInputStream (fis); Object o = ois.readObject(); if (o instanceof Table) {
ObjectInputStream ois = new org.openide.util.io.NbObjectInputStream (fis); Object o = ois.readObject(); if (o instanceof Table) {
public static void load() throws IOException { FileObject ser = getLoaderPoolStorage(false); if (ser != null) { try { ObjectInputStream ois = new NbObjectInputStream(ser.getInputStream()); try { NbObjectInputStream.readSafely(ois); } finally { ois.close(); } } catch (IOException x) { ser.delete(); // #144158: probably not valuable, just kill it throw x; } } } private static final String LOADER_POOL_NAME = "loaders.ser"; // NOI18N
org.openide.util.io.NbObjectInputStream nbis = new org.openide.util.io.NbObjectInputStream(bis); Object o = nbis.readObject(); nbis.close();