Package java.io

Examples of java.io.ObjectOutputStream.writeObject()


        final Object obj;
        try {
            // write the object
            final FastMultiByteArrayOutputStream fbos = new FastMultiByteArrayOutputStream();
            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();
View Full Code Here


    }

    public static void toStream(final Object obj, final OutputStream out) {
        try {
            final ObjectOutputStream oos = new ObjectOutputStream(out);
            oos.writeObject(obj);
            oos.flush();
            oos.close();
        } catch (Exception e) {
            throw new IllegalStateException(e);
        }
View Full Code Here

    }

    public static void toStreamVerbose(final Object obj, final OutputStream out) throws IOException {
        try {
            final ObjectOutputStream oos = new ObjectOutputStream(out);
            oos.writeObject(obj);
            oos.flush();
            oos.close();
        } catch (IOException ioe) {
            throw ioe;
        } catch (Throwable e) {
View Full Code Here

        String key = bv.getReferenceStreamId();
       
        // now force to serialize
        File saved = new File(UnitTestUtil.getTestScratchPath()+"/blobassaved.bin"); //$NON-NLS-1$
        ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(saved));
        out.writeObject(bv);
        out.close();
       
        // now read back the object from serilized state
        ObjectInputStream in = new ObjectInputStream(new FileInputStream(saved));
        BlobType read = (BlobType)in.readObject();
View Full Code Here

        String key = xv.getReferenceStreamId();
       
        // now force to serialize
        File saved = new File(UnitTestUtil.getTestScratchPath()+"/xmlsaved.bin"); //$NON-NLS-1$
        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();
View Full Code Here

 
  private byte[] writeAsByteArray(Throwable t) {
    try {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(baos);
          oos.writeObject(t);
          oos.flush();
          oos.close();
          return baos.toByteArray();
    } catch (IOException e) {
      return null;
View Full Code Here

          
      ObjectOutputStream  oos = new ObjectOutputStream( socket.getOutputStream());
     
      oos.writeInt( 0 );
     
      oos.writeObject( getHeader());
     
      oos.writeObject( args );
     
      log.messageLogged( LoggerChannel.LT_INFORMATION, "SingleInstanceHandler: arguments passed to existing process" );
     
View Full Code Here

     
      oos.writeInt( 0 );
     
      oos.writeObject( getHeader());
     
      oos.writeObject( args );
     
      log.messageLogged( LoggerChannel.LT_INFORMATION, "SingleInstanceHandler: arguments passed to existing process" );
     
      }catch( Throwable e ){
       
View Full Code Here

      try{
        ByteArrayOutputStream  baos = new ByteArrayOutputStream();
       
        ObjectOutputStream  oos = new ObjectOutputStream( baos );
       
        oos.writeObject( obj );
       
        oos.close();
       
        res = baos.toByteArray();
       
View Full Code Here

        XMLBeans xml = new XMLBeans(m_beanLayout, m_bcSupport, tabIndex);
        xml.write(sFile, v);
      } /* binary */ else {
        OutputStream os = new FileOutputStream(sFile);
        ObjectOutputStream oos = new ObjectOutputStream(os);
        oos.writeObject(beans);
        oos.writeObject(BeanConnection.getConnections(tabIndex));
        oos.flush();
        oos.close();
      }
    } catch (Exception ex) {
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.