當(dāng)前位置:
                    首頁 >
                            前端技术
>                            javascript
>内容正文                
                        
                    javascript
SpringBoot 自带工具类~ResourceUtils
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                SpringBoot 自带工具类~ResourceUtils
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.                        
                                org.springframework.util.ResourceUtils
1、從資源路徑獲取文件
// 判斷字符串是否是一個(gè)合法的 URL 字符串。 static boolean isUrl(String resourceLocation) // 獲取 URL static URL getURL(String resourceLocation) // 獲取文件(在 JAR 包內(nèi)無法正常使用,需要是一個(gè)獨(dú)立的文件) static File getFile(String resourceLocation)2、Resource
// 文件系統(tǒng)資源 D:\... FileSystemResource // URL 資源,如 file://... http://... UrlResource // 類路徑下的資源,classpth:... ClassPathResource // Web 容器上下文中的資源(jar 包、war 包) ServletContextResource // 判斷資源是否存在 boolean exists() // 從資源中獲得 File 對象 File getFile() // 從資源中獲得 URI 對象 URI getURI() // 從資源中獲得 URI 對象 URL getURL() // 獲得資源的 InputStream InputStream getInputStream() // 獲得資源的描述信息 String getDescription()總結(jié)
以上是生活随笔為你收集整理的SpringBoot 自带工具类~ResourceUtils的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
                            
                        - 上一篇: Python 操作 MongoDB
 - 下一篇: Linux 中 VIM 的使用