您好,欢迎来到12图资源库!分享精神,快乐你我!我们只是素材的搬运工!!
  • 首 页
  • 当前位置:首页 > 开发 > WEB开发 >
    效劳端WORD文件模板书签交流、转换文件类型的另类完成(9)
    时间:2021-08-11 08:50 来源:网络整理 作者:网络 浏览:收藏 挑错 推荐 打印

    public JSONObject processOffice(String srcRealPath, String descRealPath, String taskType, JSONObject jsonObject) { 

            JSONObject rtnObject = new JSONObject(); 

            String code = "200"

            String message = ""

     

            try { 

                File file = new File(srcRealPath); 

                if (!file.exists() || !file.canWrite()) { 

                    code = "200"

                    message = "文件不存在,或已被占用"

                    rtnObject.element("code", code); 

                    rtnObject.element("message", message); 

                    JSONObject var41 = rtnObject; 

                    return var41; 

                } 

     

                LOGGER.info(srcRealPath + "===>" + descRealPath); 

                if (file.exists() && file.canWrite()) { 

                    String filename = file.getName(); 

                    this.fis = new FileInputStream(file); 

                    this.dos = new DataOutputStream(this.client.getOutputStream()); 

                    this.dos.writeUTF(filename);//文件名字 

                    this.dos.flush(); 

                    this.dos.writeLong(file.length());//文件长度 

                    this.dos.flush(); 

                    String ext = descRealPath.substring(descRealPath.lastIndexOf(".") + 1, descRealPath.length()); 

                    this.dos.writeUTF(ext);//源文件后缀名字 

                    this.dos.flush(); 

                    this.dos.writeUTF(taskType);//义务类型 

                    this.dos.flush(); 

                    if (YOZOOfficeUtil.PROCESS_TYPE_CONVERTFILE.equals(taskType)) { 

                        this.dos.writeUTF(jsonObject.toString()); 

                        this.dos.flush(); 

                    } 

     

    (责任编辑:admin)