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

                        LOGGER.info("======== 转换" + ext + "完成,文件大小(" + l / 1048576L + ")M ========"); 

                        LOGGER.info("======== 末尾接受" + ext + " ========"); 

                        File newFile = new File(descRealPath); 

                        if (newFile.exists()) { 

                            newFile.delete(); 

                        } 

     

                        this.fos = new FileOutputStream(newFile); 

                        progress = 0L; 

                        bytes = new byte[1048576]; 

     

                        while((length = this.dis.read(bytes, 0, bytes.length)) != -1) { 

                            this.fos.write(bytes, 0, length); 

                            this.fos.flush(); 

                        } 

     

                        LOGGER.info("======== 接受" + ext + "文件成功========"); 

                        this.dis.close(); 

                    } else { 

                        code = "500"

                        message = "链接被强迫封锁...."

                    } 

                } else { 

                    code = "404"

                    message = "文件不存在,或已被占用:" + srcRealPath; 

                } 

            } catch (Exception e) { 

                code = "500"

                message = "客户端报错:" + e.toString(); 

                LOGGER.error("异常:",e); 

     

            } finally { 

                if (this.fis != null) { 

                    try { 

                        this.fis.close(); 

                    } catch (Exception var38) { 

                        ; 

                    } 

                } 

     

                if (this.fos != null) { 

                    try { 

                        this.fos.close(); 

                    } catch (Exception var37) { 

                        ; 

                    } 

                } 

     

                try { 

                    this.client.close(); 

                } catch (Exception var36) { 

                    ; 

                } 

     

            } 

     

            rtnObject.element("code", code); 

            rtnObject.element("message", message); 

            return rtnObject; 

        } 

     

        public static void main(String[] args) { 

            try { 

                SocketClient socketClient = new SocketClient(); 

                // 将文档转换成pdf文件 

    (责任编辑:admin)