Package java.beans

Examples of java.beans.XMLEncoder.writeObject()


    e.setPersistenceDelegate(Operator.ProgressCounter.class, new EnumDelegate());

    e.setPersistenceDelegate(org.datanucleus.sco.backed.Map.class, new MapDelegate());
    e.setPersistenceDelegate(org.datanucleus.sco.backed.List.class, new ListDelegate());

    e.writeObject(plan);
    e.close();
  }

  /**
   * Deserialize the whole query plan.
View Full Code Here


  public static void serializeMapRedWork(MapredWork w, OutputStream out) {
    XMLEncoder e = new XMLEncoder(out);
    // workaround for java 1.5
    e.setPersistenceDelegate(ExpressionTypes.class, new EnumDelegate());
    e.setPersistenceDelegate(GroupByDesc.Mode.class, new EnumDelegate());
    e.writeObject(w);
    e.close();
  }

  public static MapredWork deserializeMapRedWork(InputStream in, Configuration conf) {
    XMLDecoder d = new XMLDecoder(in, null, null, conf.getClassLoader());
View Full Code Here

  public static void serializeMapRedLocalWork(MapredLocalWork w, OutputStream out) {
    XMLEncoder e = new XMLEncoder(out);
    // workaround for java 1.5
    e.setPersistenceDelegate(ExpressionTypes.class, new EnumDelegate());
    e.setPersistenceDelegate(GroupByDesc.Mode.class, new EnumDelegate());
    e.writeObject(w);
    e.close();
  }

  public static MapredLocalWork deserializeMapRedLocalWork(InputStream in, Configuration conf) {
    XMLDecoder d = new XMLDecoder(in, null, null, conf.getClassLoader());
View Full Code Here

    try {
      fileOutputStream = new FileOutputStream(filename);
      stream = new BufferedOutputStream(fileOutputStream);
      encoder = new XMLEncoder(stream);
      encoder.writeObject(model);
    } catch (final FileNotFoundException e) {
      e.printStackTrace();
    } finally {
      try {
        if (fileOutputStream != null) {
View Full Code Here

      e.setStringStackTrace(null);
    }

    XMLEncoder enc = new XMLEncoder(new BufferedOutputStream(stream));

    enc.writeObject(e);

    enc.close();

  }
View Full Code Here

        if (optArr.contains("nobytearray")) {
          this.preprocessingNoByteArray(this.resolvableColl);
        }
      }

      e.writeObject(this.resolvableColl);
      e.close();
    }

  }
View Full Code Here

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        XMLEncoder encoder = new XMLEncoder(out);
        XMLDecoder decoder;
        Object obj;

        encoder.writeObject(new String[10]);
        encoder.close();

        decoder = new XMLDecoder(new ByteArrayInputStream(out.toByteArray()));
        obj = decoder.readObject();
        decoder.close();
View Full Code Here

                closeCalled = true;
                super.close();
            }
        };
        XMLEncoder enc = new XMLEncoder(out);
        enc.writeObject(new Integer(3));
        assertEquals(0, out.size());

        enc.close();

        assertTrue(out.size() > 0);
View Full Code Here

    public void testFlush() {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        XMLEncoder enc = new XMLEncoder(out);
        Integer i = new Integer(3);
        enc.writeObject(i);
        assertEquals(0, out.size());
        assertNotNull(enc.get(i));

        enc.flush();
View Full Code Here

                        + e.getMessage());
            }
        });

        try {
            e.writeObject(new Boolean(true));
        } finally {
            e.close();
        }
    }
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.