Package java.io

Examples of java.io.ObjectInputStream.readObject()


            this.ser23 = b;

            FastByteArrayInputStream bis3 = new FastByteArrayInputStream(b);
            ObjectInputStream ois3 = new ObjectInputStream(bis3);
            this.student2 = (Student) ois3.readObject();
            this.student3 = (Student) ois3.readObject();
        }

        @Override
        public boolean equals(Object obj) {
            if(obj instanceof PlaceHolder) {
View Full Code Here


        oos.writeObject(list1);

        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(bais);

        TLinkedList list2 = (TLinkedList) ois.readObject();
        assertEquals(list1, list2);
    }

    @Test
    public void testAddBefore() {
View Full Code Here

    try {
      byte[] subByte = StreamUtil.readByteArrayFrom(is);
      bais = new ByteArrayInputStream(subByte);
      ois = new ObjectInputStream(bais);
      try {
        subject = (Subject) ois.readObject();
      } catch (ClassNotFoundException e) {
        if (logger.isLoggable(BasicLevel.ERROR))
          logger.log(BasicLevel.ERROR, "EXCEPTION:: readFrom", e);
        throw new IOException(e.getMessage());
      }
View Full Code Here

        out.writeObject(cv);
        out.close();
       
        // now read back the object from serilized state
        ObjectInputStream in = new ObjectInputStream(new FileInputStream(saved));
        ClobType read = (ClobType)in.readObject();
       
        assertTrue(read.length() > 0);
               
        // make sure we have kept the reference stream id
        assertEquals(key, read.getReferenceStreamId());
View Full Code Here

        oos.writeObject(object);
        oos.flush();
       
        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
       
        return (T)ois.readObject();
  }

}
View Full Code Here

        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(result);
       
        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(bais);
        result = ois.readObject();
       
        ArrayList clearObject = (ArrayList)randomSymCryptor.unsealObject(result);
       
        assertEquals(test, clearObject);
       
View Full Code Here

            out.writeObject(orig);
            out.flush();
            out.close();
            // read an object
            final ObjectInputStream in = new ObjectInputStream(fbos.getInputStream());
            obj = in.readObject();
        } catch (IOException e) {
            throw new IllegalStateException(e);
        } catch (ClassNotFoundException cnfe) {
            throw new IllegalStateException(cnfe);
        }
View Full Code Here

    }

    public static <T> T readObjectQuietly(final InputStream is) {
        try {
            final ObjectInputStream ois = new ObjectInputStream(is);
            return (T) ois.readObject();
        } catch (IOException ioe) {
            IOUtils.closeQuietly(is);
            throw new IllegalStateException(ioe);
        } catch (ClassNotFoundException ce) {
            IOUtils.closeQuietly(is);
View Full Code Here

    }

    public static <T> T readObjectQuietly(final InputStream is, final ClassLoader cl) {
        try {
            final ObjectInputStream ois = new CustomObjectInputStream(is, cl);
            return (T) ois.readObject();
        } catch (IOException ioe) {
            IOUtils.closeQuietly(is);
            throw new IllegalStateException(ioe);
        } catch (ClassNotFoundException ce) {
            IOUtils.closeQuietly(is);
View Full Code Here

        }
    }

    public static <T> T readObject(final InputStream is) throws IOException, ClassNotFoundException {
        final ObjectInputStream ois = new ObjectInputStream(is);
        return (T) ois.readObject();
    }

    public static <T> T readObject(final InputStream is, final ClassLoader cl) throws IOException,
            ClassNotFoundException {
        final ObjectInputStream ois = new CustomObjectInputStream(is, cl);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.