Examples of ObjectInputStream


Examples of java.io.ObjectInputStream

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        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

Examples of java.io.ObjectInputStream

            final ObjectOutputStream out = new ObjectOutputStream(fbos);
            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

Examples of java.io.ObjectInputStream

        return ObjectUtils.<T> readObject(new FastByteArrayInputStream(obj), cl);
    }

    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

Examples of java.io.ObjectInputStream

        }
    }

    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

Examples of java.io.ObjectInputStream

            throw new IllegalStateException(ce);
        }
    }

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

Examples of java.io.ObjectInputStream

        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);
        return (T) ois.readObject();
    }
View Full Code Here

Examples of java.io.ObjectInputStream

        ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(saved));
        out.writeObject(xv);
        out.close();
       
        // now read back the object from serilized state
        ObjectInputStream in = new ObjectInputStream(new FileInputStream(saved));
        XMLType read = (XMLType)in.readObject();
               
        // make sure we have kept the reference stream id
        assertEquals(key, read.getReferenceStreamId());
       
        // and lost the original object
View Full Code Here

Examples of java.io.ObjectInputStream

  private Throwable readFromByteArray(byte[] contents) {
    // only for top level we would have the contents as not null.
    if (contents != null) {
      ByteArrayInputStream bais = new ByteArrayInputStream(contents);
      try {
        ObjectInputStream ois = new ObjectInputStreamWithClassloader(bais, ExceptionHolder.class.getClassLoader());
        return (Throwable)ois.readObject();
      } catch (Exception e) {
        //
      }
    }
    return null;
View Full Code Here

Examples of java.io.ObjectInputStream

    Table t = tm.getGroupID("Northwind.Northwind.dbo.Employees");
    assertFalse(t.isVirtual());
  }
 
  @Test public void test71Schema() throws Exception {
    ObjectInputStream ois = new ObjectInputStream(new FileInputStream(UnitTestUtil.getTestDataFile("schema.ser")));
    Schema schema = (Schema) ois.readObject();
    assertNotNull(schema.getFunctions());
  }
View Full Code Here

Examples of java.io.ObjectInputStream

   }

   public static Vector getAlertList(String requestUrl) throws IOException {

      Vector al = null;
      ObjectInputStream inFromServlet = null;
      try {

         URL studentDBservlet = new URL( requestUrl );
         URLConnection servletConnection = studentDBservlet.openConnection();
         servletConnection.setDoInput(true);
         servletConnection.setDoOutput(true);
         servletConnection.setUseCaches (false);
         servletConnection.setRequestProperty
             ("Content-Type", "application/octet-stream");
         inFromServlet = new ObjectInputStream(servletConnection.getInputStream());
         al = (Vector) inFromServlet.readObject();
      }
      catch (ClassNotFoundException e) {

         e.printStackTrace();
      }
      finally {

         if (inFromServlet != null) {

            inFromServlet.close();
         }
      }
      return al;
   }
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.