Package java.io

Examples of java.io.ObjectOutputStream.writeObject()


            throw new IllegalStateException("Does not have write permission for "
                    + file.getAbsolutePath());
        }
        try {
            ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file));
            oos.writeObject(this);
            oos.flush();
            oos.close();
        } catch (FileNotFoundException fe) {
            throw new DbException(fe);
        } catch (IOException ioe) {
View Full Code Here


        }

        try {
            writer.reset();
            writer.flush();
            writer.writeObject(object);
            writer.flush();

            return true;
        }
        catch (Exception e) {
View Full Code Here

  {
    try {

      ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream();
      ObjectOutputStream objectOutput = new ObjectOutputStream(byteOutputStream);
      objectOutput.writeObject(object);
      objectOutput.flush();
      byteOutputStream.close();
      serializer.write(byteOutputStream.size());
      serializer.write(':');
      byteOutputStream.writeTo(serializer.getOutput());
View Full Code Here

  private boolean isKeySerializable(final ResourceKey key)
  {
    try
    {
      final ObjectOutputStream oout = new ObjectOutputStream(new NullOutputStream());
      oout.writeObject(key);
      oout.close();
      return true;
    }
    catch (Exception e)
    {
View Full Code Here

            if (list != null) {
                try {
                    FileOutputStream fos = new FileOutputStream(new File(fileName[0]));
                    ObjectOutputStream oos = new ObjectOutputStream(fos);
                    oos.writeObject(list);
                    oos.close();

                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                } catch (IOException e) {
View Full Code Here

            bIsSerializable |= aInts[i].getName().equals("java.io.Serializable");
          if (bIsSerializable) {
            try {
                ByteArrayOutputStream oBOut = new ByteArrayOutputStream();
          ObjectOutputStream oOOut = new ObjectOutputStream(oBOut);
          oOOut.writeObject(oObj);
          put(sKey, oBOut.toByteArray());
          oOOut.close();
          oBOut.close();             
            } catch (IOException neverthrown) { }
          } else {
View Full Code Here

            bIsSerializable |= aInts[i].getName().equals("java.io.Serializable");
          if (bIsSerializable) {
            try {
                ByteArrayOutputStream oBOut = new ByteArrayOutputStream();
          ObjectOutputStream oOOut = new ObjectOutputStream(oBOut);
          oOOut.writeObject(oObj);
          put(sKey, oBOut.toByteArray());
          oOOut.close();
          oBOut.close();             
            } catch (IOException neverthrown) { }
          } else {
View Full Code Here

    System.out.println("saving" + f.getName());   
    try {
      FileOutputStream fos = new FileOutputStream(f);
      ObjectOutputStream os = new ObjectOutputStream(fos);
     
      os.writeObject(this);
      os.writeObject(null)// ascending compatibility
      os.flush();
      os.close();
      fos.close(); // also closes the file
     
View Full Code Here

    try {
      FileOutputStream fos = new FileOutputStream(f);
      ObjectOutputStream os = new ObjectOutputStream(fos);
     
      os.writeObject(this);
      os.writeObject(null)// ascending compatibility
      os.flush();
      os.close();
      fos.close(); // also closes the file
     
    } catch (java.io.IOException ioe) {
View Full Code Here

    b.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e) {
        bo=new ByteArrayOutputStream();
        try {
          ObjectOutputStream oo=new ObjectOutputStream(bo);
          oo.writeObject(svg);
        } catch (IOException ee) {
          ee.printStackTrace();
        }
      }
    });
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.