Class PageDir

All Implemented Interfaces:
Closeable, AutoCloseable

public class PageDir extends VirtualContainer
页面目录容器
Since:
2020-01-18 03:05:23
Author:
权观宇
  • Field Details

  • Constructor Details

  • Method Details

    • getIndex

      public Integer getIndex()
      获取页面索引
      Returns:
      页面索引
      Throws:
      NumberFormatException - 非规范的页面索引可能导致该问题
    • getIndexStr

      public String getIndexStr()
      获取页面索引字符串,默认为数字如 "1",非规范情况下将返回自定义名称
      Returns:
      页面索引字符串,默认为数字如 "1",非规范情况下将返回自定义名称
    • getPageRes

      public Res getPageRes() throws FileNotFoundException, org.dom4j.DocumentException
      获取页面资源描述文件
      Returns:
      页面资源描述文件
      Throws:
      FileNotFoundException - 资源文件不存在
      org.dom4j.DocumentException - 资源文件解析失败
    • setPageRes

      public PageDir setPageRes(Res pageRes)
      设置页面资源描述对象
      Parameters:
      pageRes - 页面资源描述对象
      Returns:
      this
    • getPageAnnot

      public PageAnnot getPageAnnot() throws FileNotFoundException, org.dom4j.DocumentException
      获取分页注释文件
      Returns:
      分页注释文件
      Throws:
      FileNotFoundException - 描述文件不存在
      org.dom4j.DocumentException - 描述文件内容错误
    • getPageAnnots

      public Map<String, PageAnnot> getPageAnnots() throws IOException
      根据页面注释文件的名称前缀获取该目录下所有注释对象

      注释文件前缀: Annot_M.xml

      Key: 文件名 Value: 注释对象

      Returns:
      容器内所有注释对象
      Throws:
      IOException - 文件读异常
    • setPageAnnot

      public PageDir setPageAnnot(PageAnnot pageAnnot)
      设置分页注释文件
      Parameters:
      pageAnnot - 分页注释文件
      Returns:
      this
    • obtainRes

      public ResDir obtainRes()
      获取页面资源目录

      如果目录不存在则创建

      Returns:
      资源目录容器
    • getResDir

      public ResDir getResDir() throws FileNotFoundException
      获取资源文件虚拟容器
      Returns:
      获取资源目录
      Throws:
      FileNotFoundException - 该页面没有资源文件目录
    • add

      public PageDir add(Path resource) throws IOException
      向页面中增加页面资源
      Parameters:
      resource - 资源
      Returns:
      this
      Throws:
      IOException - 文件复制过程中发生异常
    • addAnnot

      public ST_Loc addAnnot(PageAnnot pageAnnot) throws IOException
      向页面加入新的注释文件
      Parameters:
      pageAnnot - 注释对象
      Returns:
      注释文件容器内绝对路径
      Throws:
      IOException - 文件复制过程中发生异常
    • addAnnot

      public ST_Loc addAnnot(String fileName, PageAnnot pageAnnot)
      向页面内添加注释文件
      Parameters:
      fileName - 文件名称
      pageAnnot - 注释
      Returns:
      注释文件容器内绝对路径
    • getMaxAnnotFileIndex

      public Integer getMaxAnnotFileIndex() throws IOException
      获取当Page_N容器中最大的注释文件索引号
      Returns:
      索引数字
      Throws:
      IOException - 文件读取异常
    • get

      public Path get(String name) throws FileNotFoundException
      获取页面资源
      Parameters:
      name - 资源名称,包含后缀
      Returns:
      资源路径,如果资源不存在则为null
      Throws:
      FileNotFoundException - 文件不存在
    • getContent

      public Page getContent() throws FileNotFoundException, org.dom4j.DocumentException
      获取页面描述对象
      Returns:
      页面描述
      Throws:
      FileNotFoundException - 描述文件不存在
      org.dom4j.DocumentException - 描述文件内容错误
    • setContent

      public PageDir setContent(Page content)
      设置页面描述
      Parameters:
      content - 页面描述
      Returns:
      this