Package java.beans

Examples of java.beans.XMLDecoder.readObject()


  @Override
  public Serializable loadObject(Class valueClass, Vertex key) {
    Object value = key.getProperty(Properties.value.name());
    ByteArrayInputStream stream = new ByteArrayInputStream(value.toString().getBytes());
    XMLDecoder decoder = new XMLDecoder(stream);
    return (Serializable) decoder.readObject();
  }


  @Override
  protected Object getVertexValue(Serializable value) {
View Full Code Here


     Loads a Shape3D serialized to XML using XML encoding for Java Beans
   */ 
  static public Shape3D xml2shape(String fname) {
    try {
      XMLDecoder d = new XMLDecoder(urlInput(fname));
      Object result = d.readObject();
      d.close();
      return (Shape3D)result;
    }
    catch(Exception e) {
      e.printStackTrace();
View Full Code Here

    @Override
    @SuppressWarnings("unchecked")
    public void readData() throws IOException {
        XMLDecoder d = new XMLDecoder(new BufferedInputStream(new FileInputStream(getFile())));
        dictionary = (Map<String,Object>)d.readObject();
        customReadData(d);
        d.close();
    }

    @Override
View Full Code Here

        try
        {
            Thread.currentThread().setContextClassLoader( Utils.class.getClassLoader() );
            ByteArrayInputStream bais = new ByteArrayInputStream( LdifUtils.utf8encode( s ) );
            XMLDecoder decoder = new XMLDecoder( bais );
            Object o = decoder.readObject();
            decoder.close();
            return o;
        }
        finally
        {
View Full Code Here

    e.close();
  }

  public static MapredLocalWork deserializeMapRedLocalWork(InputStream in, Configuration conf) {
    XMLDecoder d = new XMLDecoder(in, null, null, conf.getClassLoader());
    MapredLocalWork ret = (MapredLocalWork) d.readObject();
    d.close();
    return (ret);
  }

  /**
 
View Full Code Here

      throw new RuntimeException("UTF-8 support required", ex);
    }
    ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
    XMLDecoder decoder = new XMLDecoder(bais, null, null, conf.getClassLoader());
    try {
      ExprNodeDesc expr = (ExprNodeDesc) decoder.readObject();
      return expr;
    } finally {
      decoder.close();
    }
  }
View Full Code Here

  /**
   * Deserialize the whole query plan.
   */
  public static QueryPlan deserializeQueryPlan(InputStream in, Configuration conf) {
    XMLDecoder d = new XMLDecoder(in, null, null, conf.getClassLoader());
    QueryPlan ret = (QueryPlan) d.readObject();
    d.close();
    return (ret);
  }

  /**
 
View Full Code Here

    e.close();
  }

  public static MapredWork deserializeMapRedWork(InputStream in, Configuration conf) {
    XMLDecoder d = new XMLDecoder(in, null, null, conf.getClassLoader());
    MapredWork ret = (MapredWork) d.readObject();
    d.close();
    return (ret);
  }

  /**
 
View Full Code Here

      }
    }

    DefaultTreeModel model = null;
    try {
      model = (DefaultTreeModel) decoder.readObject();
    } catch (final Exception e) {
      e.printStackTrace();
    } finally {
      decoder.close();
    }
View Full Code Here

    /*
     * test XMLDecoder constructor with null inputStream argument
     */
    public void test_Constructor_NullInputStream_scenario1() {
        XMLDecoder xmlDecoder = new XMLDecoder(null);
        assertNull(xmlDecoder.readObject());
        assertNull(xmlDecoder.getOwner());
        assertNotNull(xmlDecoder.getExceptionListener());
        xmlDecoder.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.