Package java.beans

Examples of java.beans.XMLEncoder.writeObject()


public class BeanXMLByteCoder implements ByteCoder {

    /** {@inheritDoc} */
    public void encode(Object source, OutputStream target) throws IOException {
        XMLEncoder xmlOut = new XMLEncoder(target);
        xmlOut.writeObject(source);
        xmlOut.close();
    }
   
    /** {@inheritDoc} */
    public Object decode(InputStream source) throws IOException {
View Full Code Here


    public void save() throws IOException {
        File xml = new File(projectLocation  + "\\config.xml");
        if (xml.exists()) xml.delete();
        FileOutputStream output = new FileOutputStream(projectLocation  + "\\config.xml");
        XMLEncoder encoder = new XMLEncoder(output);
        encoder.writeObject(projectName);
        encoder.writeObject(projectLocation);
        encoder.writeObject(studentsFolder);
        encoder.writeObject(testsFolder);
        encoder.writeObject(assignmentType);
        encoder.close();
View Full Code Here

        File xml = new File(projectLocation  + "\\config.xml");
        if (xml.exists()) xml.delete();
        FileOutputStream output = new FileOutputStream(projectLocation  + "\\config.xml");
        XMLEncoder encoder = new XMLEncoder(output);
        encoder.writeObject(projectName);
        encoder.writeObject(projectLocation);
        encoder.writeObject(studentsFolder);
        encoder.writeObject(testsFolder);
        encoder.writeObject(assignmentType);
        encoder.close();
        output.close();
View Full Code Here

        if (xml.exists()) xml.delete();
        FileOutputStream output = new FileOutputStream(projectLocation  + "\\config.xml");
        XMLEncoder encoder = new XMLEncoder(output);
        encoder.writeObject(projectName);
        encoder.writeObject(projectLocation);
        encoder.writeObject(studentsFolder);
        encoder.writeObject(testsFolder);
        encoder.writeObject(assignmentType);
        encoder.close();
        output.close();
    }
View Full Code Here

        FileOutputStream output = new FileOutputStream(projectLocation  + "\\config.xml");
        XMLEncoder encoder = new XMLEncoder(output);
        encoder.writeObject(projectName);
        encoder.writeObject(projectLocation);
        encoder.writeObject(studentsFolder);
        encoder.writeObject(testsFolder);
        encoder.writeObject(assignmentType);
        encoder.close();
        output.close();
    }
View Full Code Here

        XMLEncoder encoder = new XMLEncoder(output);
        encoder.writeObject(projectName);
        encoder.writeObject(projectLocation);
        encoder.writeObject(studentsFolder);
        encoder.writeObject(testsFolder);
        encoder.writeObject(assignmentType);
        encoder.close();
        output.close();
    }

    @Override
View Full Code Here

  @Override
  protected Object getVertexValue(Serializable value) {
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    XMLEncoder encoder = new XMLEncoder(stream);
    encoder.writeObject(value);
    encoder.close();
    try {
      stream.close();
      return new String(stream.toByteArray());
    } catch (IOException e) {
View Full Code Here

    }

    @Override
    public void writeData() throws IOException {
        XMLEncoder e = new XMLEncoder(new BufferedOutputStream(new FileOutputStream(getFile())));
        e.writeObject(dictionary);
        customWriteData(e);
        e.close();
    }

    public void customReadData(XMLDecoder d) {
View Full Code Here

        try
        {
            Thread.currentThread().setContextClassLoader( Utils.class.getClassLoader() );
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            XMLEncoder encoder = new XMLEncoder( baos );
            encoder.writeObject( o );
            encoder.close();
            String s = LdifUtils.utf8decode( baos.toByteArray() );
            return s;
        }
        finally
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

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.