程序包 weka.core.xml

类 XStream

java.lang.Object
weka.core.xml.XStream
所有已实现的接口:
RevisionHandler

public class XStream extends Object implements RevisionHandler
This class is a helper class for XML serialization using XStream . XStream does not need to be present, since the class-calls are done generically via Reflection.
版本:
$Revision: 5562 $
作者:
Mark Hall (mhall{[at]}pentaho{[dot]}org)
  • 字段详细资料

    • FILE_EXTENSION

      public static final String FILE_EXTENSION
      the extension for XStream files (including '.')
      另请参阅:
  • 构造器详细资料

    • XStream

      public XStream()
  • 方法详细资料

    • isPresent

      public static boolean isPresent()
      returns whether XStream is present or not, i.e. whether the classes are in the classpath or not
      返回:
      whether XStream is available
    • serialize

      public static String serialize(Object toSerialize) throws Exception
      Serializes the supplied object xml
      参数:
      toSerialize - the object to serialize
      返回:
      the serialized object as an XML string
      抛出:
      Exception - if something goes wrong
    • write

      public static boolean write(String filename, Object o) throws Exception
      writes the XML-serialized object to the given file
      参数:
      filename - the file to serialize the object to
      o - the object to write to the file
      返回:
      whether writing was successful or not
      抛出:
      Exception - if something goes wrong while writing to the file
    • write

      public static boolean write(File file, Object o) throws Exception
      write the XML-serialized object to the given file
      参数:
      file - the file to serialize the object to
      o - the object to write to the file
      返回:
      whether writing was successful or not
      抛出:
      Exception - if something goes wrong while writing to the file
    • write

      public static boolean write(OutputStream stream, Object o) throws Exception
      writes the XML-serialized object to the given output stream
      参数:
      stream - the output stream
      o - the object to write
      返回:
      true if everything goes ok
      抛出:
      Exception
    • write

      public static boolean write(Writer writer, Object toSerialize) throws Exception
      writes the XML-serialized object to the given Writer
      参数:
      writer - the Writer
      o - the object to write
      返回:
      true if everything goes ok
      抛出:
      Exception
    • read

      public static Object read(String filename) throws Exception
      reads the XML-serialized object from the given file
      参数:
      filename - the file to deserialize the object from
      返回:
      the deserialized object
      抛出:
      Exception - if something goes wrong while reading from the file
    • read

      public static Object read(File file) throws Exception
      reads the XML-serialized object from the given file
      参数:
      file - the file to deserialize the object from
      返回:
      the deserialized object
      抛出:
      Exception - if something goes wrong while reading from the file
    • read

      public static Object read(InputStream stream) throws Exception
      reads the XML-serialized object from the given input stream
      参数:
      stream - the input stream
      返回:
      the deserialized object
      抛出:
      Exception - if something goes wrong while reading from stream
    • read

      public static Object read(Reader r) throws Exception
      reads the XML-serialized object from the given Reader
      参数:
      r - the reader
      返回:
      the deserialized object
      抛出:
      Exception - if something goes wrong while reading from stream
    • deSerialize

      public static Object deSerialize(String xmlString) throws Exception
      Deserializes an object from the supplied XML string
      参数:
      xmlString - the XML to deserialize from
      返回:
      the deserialized object
      抛出:
      Exception - if something goes wrong
    • getRevision

      public String getRevision()
      Returns the revision string.
      指定者:
      getRevision 在接口中 RevisionHandler
      返回:
      the revision