Class ElemCup

java.lang.Object
org.ofdrw.pkg.tool.ElemCup

public class ElemCup extends Object
元素杯子

对象序列化和反序列化工具

反序列化 向杯子中注入水

序列化把杯子中的水倒出

Since:
2020-4-2 20:20:57
Author:
权观宇
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static boolean
    是否允许调试模式输出XML内容
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static byte[]
    dump(org.dom4j.Element e)
    序列化DOM元素为字节序列
    static void
    dump(org.dom4j.Element e, Path to)
    序列化文档对象
    static void
    dumpUpNS(org.dom4j.Element e, Path to)
    序列化元素并升级命名空间
    static org.dom4j.Element
    inject(Path file)
    从文件加载反序列化元素对象

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ENABLE_DEBUG_PRINT

      public static boolean ENABLE_DEBUG_PRINT
      是否允许调试模式输出XML内容

      true - 开启,XML含有空格和换行 false - 关闭。XML采用紧凑模式输出,(默认)

  • Constructor Details

    • ElemCup

      public ElemCup()
  • Method Details

    • inject

      public static org.dom4j.Element inject(Path file) throws org.dom4j.DocumentException
      从文件加载反序列化元素对象
      Parameters:
      file - 文件路径对象
      Returns:
      反序列化的元素对象
      Throws:
      org.dom4j.DocumentException - 文件解析异常
    • dump

      public static void dump(org.dom4j.Element e, Path to) throws IOException
      序列化文档对象
      Parameters:
      e - 文档对象
      to - 目标目录
      Throws:
      IOException - IO异常
    • dumpUpNS

      public static void dumpUpNS(org.dom4j.Element e, Path to) throws IOException
      序列化元素并升级命名空间

      命名空间为 Const.OFD_NAMESPACE

      Parameters:
      e - 元素
      to - 存储位置
      Throws:
      IOException - IO异常
    • dump

      public static byte[] dump(org.dom4j.Element e) throws IOException
      序列化DOM元素为字节序列
      Parameters:
      e - 元素
      Returns:
      XML UTF-8编码后的字节数字
      Throws:
      IOException - IO异常