程序包 com.sh.util
类 ResourceUtil
java.lang.Object
com.sh.util.ResourceUtil
Description: 读取资源文件
Title:首亨软件 - CRM、TSS、ERP等信息化管理软件
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static intdeleteFile(String path) static intexistsFile(String path) static List<org.apache.commons.vfs2.FileObject>findFile(org.apache.commons.vfs2.FileObject fileObject, FileCondition fileCondition) 查找所有文件,包括子目录文件static intgetAudoTimeSec(String path) 获取音频文件时长static CommonServer_I获取文件传送对象static String获取资源服务器static FileServer_I获取文件传送对象static FileServer2_I获取文件传送对象static InputStreamgetServerFile(jakarta.servlet.http.HttpServletRequest request, String path) 从服务器上获取文件static InputStreamgetServerFile(String path) 从服务器上获取文件static org.apache.commons.vfs2.FileObjectloadJarFile(String jarPath) 加载JAR包static org.apache.commons.vfs2.FileObjectloadJarFileByAbsPath(String jarPath) 通过JAR文件绝对路径加载JAR文件static org.apache.commons.vfs2.FileObjectloadZipFile(String zipPath) 加载ZIP包static org.apache.commons.vfs2.FileObjectloadZipFileByAbsPath(String zipPath) 通过JAR文件绝对路径加载JAR文件static String[]传送文件到资源服务器static String[]sendFile(InputStream is, String path) static String[]sendFile(InputStream is, String path, boolean isCompressVideo) 传送文件到资源服务器static String[]sendImageAndScale(byte[] data, String path, String scalePath, int width, int height) 传送文件到资源服务器static String[]sendImageAndScale(InputStream is, String path, String scalePath, int width, int height) 传送图片到资源服务器并压缩,即上传原图后,会同时存一张压缩后的小图static InputStreamtoInputStream(org.apache.commons.vfs2.FileObject fileObject) 转化为输入流static OutputStreamtoOutputStream(org.apache.commons.vfs2.FileObject fileObject) 转化为输出流static String文件路径转化为资源服务器路径static String文件路径转化为资源服务器路径
-
字段详细资料
-
fileSeparator
-
-
构造器详细资料
-
ResourceUtil
public ResourceUtil()
-
-
方法详细资料
-
getFileSeparator
获取资源服务器- 返回:
- String
-
sendImageAndScale
public static String[] sendImageAndScale(InputStream is, String path, String scalePath, int width, int height) 传送图片到资源服务器并压缩,即上传原图后,会同时存一张压缩后的小图- 参数:
is- 图片流path- 上传资源服务器路径scalePath- 资源服务器存储的压缩后的图片的路径width- 压缩宽度height- 压缩高度- 返回:
- String[] 注意,压缩宽度与高度会按比例压缩,同时需要资源服务器支持
-
sendFile
-
sendFile
传送文件到资源服务器- 参数:
is- InputStreampath- StringisCompressVideo- boolean- 返回:
- String[]
-
sendFile
传送文件到资源服务器- 参数:
data- byte[] 文件数据path- 文件路径- 返回:
- String[]
-
sendImageAndScale
public static String[] sendImageAndScale(byte[] data, String path, String scalePath, int width, int height) 传送文件到资源服务器- 参数:
data- byte[]图片数据path- 资源服务器保存路径scalePath- 缩放后路径width- 宽度height- 高度- 返回:
- String[]
-
getServerFile
public static InputStream getServerFile(jakarta.servlet.http.HttpServletRequest request, String path) 从服务器上获取文件- 参数:
request- HttpServletRequestpath- 相对路径- 返回:
- InputStream
-
getServerFile
从服务器上获取文件- 参数:
path- 相对路径- 返回:
- InputStream
-
existsFile
-
deleteFile
-
getAudoTimeSec
获取音频文件时长- 参数:
path- 路径- 返回:
-
getFileServer
获取文件传送对象- 返回:
- FileServer_I
-
getFileServer2
获取文件传送对象- 返回:
-
getCommonServer
获取文件传送对象- 返回:
- CommonServer_I
-
loadJarFile
加载JAR包- 参数:
jarPath- JAR包文件路径 jar:// arch-file-uri[! absolute-path] 如:jar:../lib/classes.jar!/META-INF/manifest.mf- 返回:
- FileObject
-
loadJarFileByAbsPath
通过JAR文件绝对路径加载JAR文件- 参数:
jarPath- 绝对路径,如:F:\\apache\\commons-lang.jar- 返回:
- FileObject
-
loadZipFile
加载ZIP包- 参数:
zipPath- ZIP包文件路径 zip:// arch-file-uri[! absolute-path]- 返回:
- FileObject
-
loadZipFileByAbsPath
通过JAR文件绝对路径加载JAR文件- 参数:
zipPath- 绝对路径- 返回:
- FileObject
-
findFile
public static List<org.apache.commons.vfs2.FileObject> findFile(org.apache.commons.vfs2.FileObject fileObject, FileCondition fileCondition) 查找所有文件,包括子目录文件- 参数:
fileObject- 根文件对象fileCondition- 文件名匹配条件- 返回:
- 所有匹配文件
-
toInputStream
转化为输入流- 参数:
fileObject- FileObject- 返回:
- InputStream
-
toOutputStream
转化为输出流- 参数:
fileObject- FileObject- 返回:
- OutputStream
-
toResPath
文件路径转化为资源服务器路径- 参数:
path-- 返回:
-
toResPath
文件路径转化为资源服务器路径- 参数:
path-- 返回:
-