gpt4 book ai didi

com.thoughtworks.xstream.XStreamer类的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 04:51:05 27 4
gpt4 key购买 nike

本文整理了Java中com.thoughtworks.xstream.XStreamer类的一些代码示例,展示了XStreamer类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XStreamer类的具体详情如下:
包路径:com.thoughtworks.xstream.XStreamer
类名称:XStreamer

XStreamer介绍

[英]Self-contained XStream generator. The class is a utility to write XML streams that contain additionally the XStream that was used to serialize the object graph. Such a stream can be unmarshalled using this embedded XStream instance, that kept any settings.
[中]独立的XStream生成器。该类是一个用于编写XML流的实用程序,该XML流还包含用于序列化对象图的XStream。这样的流可以使用这个嵌入的XStream实例进行解组,该实例保留了任何设置。

代码示例

代码示例来源:origin: com.thoughtworks.xstream/xstream

/**
 * Deserialize a self-contained XStream with object from an XML Reader.
 *
 * @param driver the implementation to use
 * @param xml the {@link Reader} providing the XML data
 * @throws IOException if an error occurs reading from the Reader.
 * @throws ClassNotFoundException if a class in the XML stream cannot be found
 * @throws com.thoughtworks.xstream.XStreamException if the object cannot be deserialized
 * @since 1.2
 */
public Object fromXML(final HierarchicalStreamDriver driver, final Reader xml)
    throws IOException, ClassNotFoundException {
  return fromXML(driver, xml, PERMISSIONS);
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

/**
 * Serialize an object including the XStream to a pretty-printed XML String.
 * 
 * @throws ObjectStreamException if the XML contains non-serializable elements
 * @throws com.thoughtworks.xstream.XStreamException if the object cannot be serialized
 * @since 1.2
 * @see #toXML(XStream, Object, Writer)
 */
public String toXML(final XStream xstream, final Object obj) throws ObjectStreamException {
  final Writer writer = new StringWriter();
  try {
    toXML(xstream, obj, writer);
  } catch (final ObjectStreamException e) {
    throw e;
  } catch (final IOException e) {
    throw new StreamException("Unexpected IO error from a StringWriter", e);
  }
  return writer.toString();
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

/**
 * Deserialize a self-contained XStream with object from an XML Reader. The method will use
 * internally an XppDriver to load the contained XStream instance with default permissions.
 * 
 * @param xml the {@link Reader} providing the XML data
 * @throws IOException if an error occurs reading from the Reader.
 * @throws ClassNotFoundException if a class in the XML stream cannot be found
 * @throws com.thoughtworks.xstream.XStreamException if the object cannot be deserialized
 * @since 1.2
 * @see #toXML(XStream, Object, Writer)
 */
public Object fromXML(final Reader xml)
    throws IOException, ClassNotFoundException {
  return fromXML(new XppDriver(), xml);
}

代码示例来源:origin: x-stream/xstream

/**
 * Serialize an object including the XStream to a pretty-printed XML String.
 *
 * @throws ObjectStreamException if the XML contains non-serializable elements
 * @throws com.thoughtworks.xstream.XStreamException if the object cannot be serialized
 * @since 1.2
 * @see #toXML(XStream, Object, Writer)
 */
public String toXML(final XStream xstream, final Object obj) throws ObjectStreamException {
  final Writer writer = new StringWriter();
  try {
    toXML(xstream, obj, writer);
  } catch (final ObjectStreamException e) {
    throw e;
  } catch (final IOException e) {
    throw new StreamException("Unexpected IO error from a StringWriter", e);
  }
  return writer.toString();
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

/**
 * Deserialize a self-contained XStream with object from an XML Reader. The method will use
 * internally an XppDriver to load the contained XStream instance.
 * 
 * @param xml the {@link Reader} providing the XML data
 * @param permissions the permissions to use (ensure that they include the defaults)
 * @throws IOException if an error occurs reading from the Reader.
 * @throws ClassNotFoundException if a class in the XML stream cannot be found
 * @throws com.thoughtworks.xstream.XStreamException if the object cannot be deserialized
 * @since 1.4.7
 * @see #toXML(XStream, Object, Writer)
 */
public Object fromXML(final Reader xml, final TypePermission[] permissions)
    throws IOException, ClassNotFoundException {
  return fromXML(new XppDriver(), xml, permissions);
}

代码示例来源:origin: com.haulmont.thirdparty/xstream

/**
 * Serialize an object including the XStream to a pretty-printed XML String.
 * 
 * @throws ObjectStreamException if the XML contains non-serializable elements
 * @throws com.thoughtworks.xstream.XStreamException if the object cannot be serialized
 * @since 1.2
 * @see #toXML(XStream, Object, Writer)
 */
public String toXML(XStream xstream, Object obj) throws ObjectStreamException {
  Writer writer = new StringWriter();
  try {
    toXML(xstream, obj, writer);
  } catch (ObjectStreamException e) {
    throw e;
  } catch (IOException e) {
    throw new ConversionException("Unexpeced IO error from a StringWriter", e);
  }
  return writer.toString();
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

/**
 * Deserialize a self-contained XStream with object from a String. The method will use
 * internally an XppDriver to load the contained XStream instance with default permissions.
 * 
 * @param xml the XML data
 * @throws ClassNotFoundException if a class in the XML stream cannot be found
 * @throws ObjectStreamException if the XML contains non-deserializable elements
 * @throws com.thoughtworks.xstream.XStreamException if the object cannot be deserialized
 * @since 1.2
 * @see #toXML(XStream, Object, Writer)
 */
public Object fromXML(final String xml) throws ClassNotFoundException, ObjectStreamException {
  try {
    return fromXML(new StringReader(xml));
  } catch (final ObjectStreamException e) {
    throw e;
  } catch (final IOException e) {
    throw new StreamException("Unexpected IO error from a StringReader", e);
  }
}

代码示例来源:origin: ovea-deprecated/jetty-session-redis

/**
 * Serialize an object including the XStream to a pretty-printed XML String.
 * 
 * @throws ObjectStreamException if the XML contains non-serializable elements
 * @throws com.thoughtworks.xstream.XStreamException if the object cannot be serialized
 * @since 1.2
 * @see #toXML(XStream, Object, Writer)
 */
public String toXML(XStream xstream, Object obj) throws ObjectStreamException {
  Writer writer = new StringWriter();
  try {
    toXML(xstream, obj, writer);
  } catch (ObjectStreamException e) {
    throw e;
  } catch (IOException e) {
    throw new ConversionException("Unexpeced IO error from a StringWriter", e);
  }
  return writer.toString();
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

/**
 * Deserialize a self-contained XStream with object from a String.
 * 
 * @param driver the implementation to use
 * @param xml the XML data
 * @throws ClassNotFoundException if a class in the XML stream cannot be found
 * @throws ObjectStreamException if the XML contains non-deserializable elements
 * @throws com.thoughtworks.xstream.XStreamException if the object cannot be deserialized
 * @since 1.2
 * @see #toXML(XStream, Object, Writer)
 */
public Object fromXML(final HierarchicalStreamDriver driver, final String xml)
    throws ClassNotFoundException, ObjectStreamException {
  try {
    return fromXML(driver, new StringReader(xml));
  } catch (final ObjectStreamException e) {
    throw e;
  } catch (final IOException e) {
    throw new StreamException("Unexpected IO error from a StringReader", e);
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream-java8

/**
 * Serialize an object including the XStream to a pretty-printed XML String.
 * 
 * @throws ObjectStreamException if the XML contains non-serializable elements
 * @throws com.thoughtworks.xstream.XStreamException if the object cannot be serialized
 * @since 1.2
 * @see #toXML(XStream, Object, Writer)
 */
public String toXML(final XStream xstream, final Object obj) throws ObjectStreamException {
  final Writer writer = new StringWriter();
  try {
    toXML(xstream, obj, writer);
  } catch (final ObjectStreamException e) {
    throw e;
  } catch (final IOException e) {
    throw new StreamException("Unexpected IO error from a StringWriter", e);
  }
  return writer.toString();
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

/**
 * Deserialize a self-contained XStream with object from a String. The method will use
 * internally an XppDriver to load the contained XStream instance.
 * 
 * @param xml the XML data
 * @param permissions the permissions to use (ensure that they include the defaults)
 * @throws ClassNotFoundException if a class in the XML stream cannot be found
 * @throws ObjectStreamException if the XML contains non-deserializable elements
 * @throws com.thoughtworks.xstream.XStreamException if the object cannot be deserialized
 * @since 1.4.7
 * @see #toXML(XStream, Object, Writer)
 */
public Object fromXML(final String xml, final TypePermission[] permissions) throws ClassNotFoundException, ObjectStreamException {
  try {
    return fromXML(new StringReader(xml), permissions);
  } catch (final ObjectStreamException e) {
    throw e;
  } catch (final IOException e) {
    throw new StreamException("Unexpected IO error from a StringReader", e);
  }
}

代码示例来源:origin: org.sonatype.nexus.xstream/xstream

/**
 * Serialize an object including the XStream to a pretty-printed XML String.
 * 
 * @throws ObjectStreamException if the XML contains non-serializable elements
 * @throws com.thoughtworks.xstream.XStreamException if the object cannot be serialized
 * @since 1.2
 * @see #toXML(XStream, Object, Writer)
 */
public String toXML(XStream xstream, Object obj) throws ObjectStreamException {
  Writer writer = new StringWriter();
  try {
    toXML(xstream, obj, writer);
  } catch (ObjectStreamException e) {
    throw e;
  } catch (IOException e) {
    throw new ConversionException("Unexpeced IO error from a StringWriter", e);
  }
  return writer.toString();
}

代码示例来源:origin: com.thoughtworks.xstream/xstream

/**
 * Deserialize a self-contained XStream with object from a String.
 * 
 * @param driver the implementation to use
 * @param xml the XML data
 * @param permissions the permissions to use (ensure that they include the defaults)
 * @throws ClassNotFoundException if a class in the XML stream cannot be found
 * @throws ObjectStreamException if the XML contains non-deserializable elements
 * @throws com.thoughtworks.xstream.XStreamException if the object cannot be deserialized
 * @since 1.4.7
 * @see #toXML(XStream, Object, Writer)
 */
public Object fromXML(final HierarchicalStreamDriver driver, final String xml, final TypePermission[] permissions)
    throws ClassNotFoundException, ObjectStreamException {
  try {
    return fromXML(driver, new StringReader(xml), permissions);
  } catch (final ObjectStreamException e) {
    throw e;
  } catch (final IOException e) {
    throw new StreamException("Unexpected IO error from a StringReader", e);
  }
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Serialize an object including the XStream to a pretty-printed XML String.
 * 
 * @throws ObjectStreamException if the XML contains non-serializable elements
 * @throws com.thoughtworks.xstream.XStreamException if the object cannot be serialized
 * @since 1.2
 * @see #toXML(XStream, Object, Writer)
 */
public String toXML(final XStream xstream, final Object obj) throws ObjectStreamException {
  final Writer writer = new StringWriter();
  try {
    toXML(xstream, obj, writer);
  } catch (final ObjectStreamException e) {
    throw e;
  } catch (final IOException e) {
    throw new StreamException("Unexpected IO error from a StringWriter", e);
  }
  return writer.toString();
}

代码示例来源:origin: x-stream/xstream

/**
 * Deserialize a self-contained XStream with object from an XML Reader.
 *
 * @param driver the implementation to use
 * @param xml the {@link Reader} providing the XML data
 * @throws IOException if an error occurs reading from the Reader.
 * @throws ClassNotFoundException if a class in the XML stream cannot be found
 * @throws com.thoughtworks.xstream.XStreamException if the object cannot be deserialized
 * @since 1.2
 */
public <T> T fromXML(final HierarchicalStreamDriver driver, final Reader xml)
    throws IOException, ClassNotFoundException {
  return fromXML(driver, xml, PERMISSIONS);
}

代码示例来源:origin: org.jvnet.hudson/xstream

/**
 * Serialize an object including the XStream to a pretty-printed XML String.
 * 
 * @throws ObjectStreamException if the XML contains non-serializable elements
 * @throws com.thoughtworks.xstream.XStreamException if the object cannot be serialized
 * @since 1.2
 * @see #toXML(XStream, Object, Writer)
 */
public String toXML(XStream xstream, Object obj) throws ObjectStreamException {
  Writer writer = new StringWriter();
  try {
    toXML(xstream, obj, writer);
  } catch (ObjectStreamException e) {
    throw e;
  } catch (IOException e) {
    throw new ConversionException("Unexpeced IO error from a StringWriter", e);
  }
  return writer.toString();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream-java8

/**
 * Deserialize a self-contained XStream with object from an XML Reader.
 *
 * @param driver the implementation to use
 * @param xml the {@link Reader} providing the XML data
 * @throws IOException if an error occurs reading from the Reader.
 * @throws ClassNotFoundException if a class in the XML stream cannot be found
 * @throws com.thoughtworks.xstream.XStreamException if the object cannot be deserialized
 * @since 1.2
 */
public Object fromXML(final HierarchicalStreamDriver driver, final Reader xml)
    throws IOException, ClassNotFoundException {
  return fromXML(driver, xml, PERMISSIONS);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream

/**
 * Serialize an object including the XStream to a pretty-printed XML String.
 * 
 * @throws ObjectStreamException if the XML contains non-serializable elements
 * @throws com.thoughtworks.xstream.XStreamException if the object cannot be serialized
 * @since 1.2
 * @see #toXML(XStream, Object, Writer)
 */
public String toXML(final XStream xstream, final Object obj) throws ObjectStreamException {
  final Writer writer = new StringWriter();
  try {
    toXML(xstream, obj, writer);
  } catch (final ObjectStreamException e) {
    throw e;
  } catch (final IOException e) {
    throw new StreamException("Unexpected IO error from a StringWriter", e);
  }
  return writer.toString();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xstream

/**
 * Deserialize a self-contained XStream with object from an XML Reader.
 *
 * @param driver the implementation to use
 * @param xml the {@link Reader} providing the XML data
 * @throws IOException if an error occurs reading from the Reader.
 * @throws ClassNotFoundException if a class in the XML stream cannot be found
 * @throws com.thoughtworks.xstream.XStreamException if the object cannot be deserialized
 * @since 1.2
 */
public Object fromXML(final HierarchicalStreamDriver driver, final Reader xml)
    throws IOException, ClassNotFoundException {
  return fromXML(driver, xml, PERMISSIONS);
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Deserialize a self-contained XStream with object from an XML Reader.
 *
 * @param driver the implementation to use
 * @param xml the {@link Reader} providing the XML data
 * @throws IOException if an error occurs reading from the Reader.
 * @throws ClassNotFoundException if a class in the XML stream cannot be found
 * @throws com.thoughtworks.xstream.XStreamException if the object cannot be deserialized
 * @since 1.2
 */
public Object fromXML(final HierarchicalStreamDriver driver, final Reader xml)
    throws IOException, ClassNotFoundException {
  return fromXML(driver, xml, PERMISSIONS);
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com