Package java.io

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


        }
    }

    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

            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

        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

        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

  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

    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

   }

   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

            run()
          {
                while ( true ){
                 
                  Socket socket      = null;
                  ObjectInputStream  ois  = null;
                 
                  try{
                    socket = server_socket.accept();
                   
                    String address = socket.getInetAddress().getHostAddress();
                   
                    if ( !( address.equals("localhost") || address.equals("127.0.0.1"))){
                     
                      socket.close();
                     
                      continue;
                    }
                   
                    ois = new ObjectInputStream( socket.getInputStream());
                   
                    ois.readInt()// version
                   
                    String  header = (String)ois.readObject();
                   
                    if ( !header.equals( getHeader())){
                     
                      log.messageLogged(
                          LoggerChannel.LT_ERROR,
                          "SingleInstanceHandler: invalid header - " + header );
                     
                      continue;
                    }

                    String[]  args = (String[])ois.readObject();
                   
                    handler.processArguments( args );
                   
                  }catch( Throwable e ){
                   
                    log.messageLogged( "SingleInstanceHandler: receive error", e );

                  }finally{
                   
                    if ( ois != null ){
                      try{
                        ois.close();
                       
                      }catch( Throwable e ){
                      }
                    }
                   
View Full Code Here

        beans        = (Vector) v.get(XMLBeans.INDEX_BEANINSTANCES);
        connections  = (Vector) v.get(XMLBeans.INDEX_BEANCONNECTIONS);
        //connections  = new Vector();
      } /* binary */ else {
        InputStream is = new FileInputStream(oFile);
        ObjectInputStream ois = new ObjectInputStream(is);
        beans = (Vector) ois.readObject();
        connections = (Vector) ois.readObject();
        ois.close();
      }               

      integrateFlow(beans, connections, true, false);
      setEnvironment();
      if (newTab) {
View Full Code Here

TOP

Related Classes of java.io.ObjectInputStream

Copyright © 2018 www.massapicom. 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.