Package java.io

Examples of java.io.ObjectOutputStream


        }
    }

    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) {
            throw new IOException(PrintUtils.prettyPrintStackTrace(e));
        }
View Full Code Here


        BlobType bv = new BlobType(blob);
        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

        XMLType xv = new XMLType(xml);
        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

    Socket  socket = null;
 
    try{
      socket = new Socket( "127.0.0.1", port );
          
      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" );
     
      }catch( Throwable e ){
       
View Full Code Here

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

            BeanConnection.getConnections(tabIndex));
        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) {
      m_logPanel.statusMessage("[KnowledgeFlow]|Unable to save flow (see log).");
      m_logPanel.logMessage("[KnowledgeFlow] Unable to save flow ("
          + ex.getMessage() + ").");
View Full Code Here

                    m_mainKFPerspective.getCurrentTabIndex());
                xml.write(sFile2, m_userComponents);
              }
              else { */
          OutputStream os = new FileOutputStream(sFile2);
          ObjectOutputStream oos = new ObjectOutputStream(os);
          oos.writeObject(m_userComponents);
          oos.flush();
          oos.close();
          //}
        } catch (Exception ex) {
          System.err.println("[KnowledgeFlow] Unable to save user components");
          ex.printStackTrace();
        }
View Full Code Here

   @BeforeMethod(alwaysRun = true)
   public void setUp() throws Exception
   {

      byteStream = new ByteArrayOutputStream();
      stream = new ObjectOutputStream(byteStream);
      command1 = new PutDataMapCommand(null, Fqn.ROOT, null);

      list = new ArrayList<WriteCommand>(2);
      list.add(command1);
      list.add(new PutDataMapCommand(null, Fqn.ROOT, null));
View Full Code Here

   }

   private int getAndTestSize(CacheMarshaller200 m, int i) throws IOException
   {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(baos);
      m.writeUnsignedInt(oos, i);
      oos.flush();
      oos.close();
      baos.flush();
      baos.close();
      byte[] bytes = baos.toByteArray();
      int byteL = bytes.length;
      assert i == m.readUnsignedInt(new ObjectInputStream(new ByteArrayInputStream(bytes)));
View Full Code Here

TOP

Related Classes of java.io.ObjectOutputStream

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.