io.advantageous.boon.core.IO.getWindowsPathIfNeeded()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(250)

本文整理了Java中io.advantageous.boon.core.IO.getWindowsPathIfNeeded()方法的一些代码示例,展示了IO.getWindowsPathIfNeeded()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IO.getWindowsPathIfNeeded()方法的具体详情如下:
包路径:io.advantageous.boon.core.IO
类名称:IO
方法名:getWindowsPathIfNeeded

IO.getWindowsPathIfNeeded介绍

暂无

代码示例

代码示例来源:origin: io.advantageous.boon/boon-reflekt

  1. private static List<String> readLines( String location, URI uri ) throws Exception {
  2. try {
  3. String path = location;
  4. path = getWindowsPathIfNeeded( path );
  5. FileSystem fileSystem = FileSystems.getFileSystem( uri );
  6. Path fsPath = fileSystem.getPath( path );
  7. //Paths.get()
  8. return Files.readAllLines( fsPath, DEFAULT_CHARSET );
  9. } catch ( ProviderNotFoundException ex ) {
  10. return readLines( uri.toURL().openStream() );
  11. }
  12. }

代码示例来源:origin: com.github.advantageous/boon-reflekt

  1. private static List<String> readLines( String location, URI uri ) throws Exception {
  2. try {
  3. String path = location;
  4. path = getWindowsPathIfNeeded( path );
  5. FileSystem fileSystem = FileSystems.getFileSystem( uri );
  6. Path fsPath = fileSystem.getPath( path );
  7. //Paths.get()
  8. return Files.readAllLines( fsPath, DEFAULT_CHARSET );
  9. } catch ( ProviderNotFoundException ex ) {
  10. return readLines( uri.toURL().openStream() );
  11. }
  12. }

代码示例来源:origin: com.github.advantageous/boon-reflekt

  1. public static List<String> readLines( final String location ) {
  2. final String path = getWindowsPathIfNeeded( location );
  3. final URI uri = createURI( path );
  4. return ( List<String> ) Exceptions.tryIt( Typ.list, new Exceptions.TrialWithReturn<List>() {
  5. @Override
  6. public List<String> tryIt() throws Exception {
  7. if ( uri.getScheme() == null ) {
  8. Path thePath = FileSystems.getDefault().getPath( path );
  9. return Files.readAllLines( thePath, DEFAULT_CHARSET );
  10. } else if ( uri.getScheme().equals( FILE_SCHEMA ) ) {
  11. Path thePath = FileSystems.getDefault().getPath( uri.getPath() );
  12. return Files.readAllLines( thePath, DEFAULT_CHARSET );
  13. } else {
  14. return readLines( location, uri );
  15. }
  16. }
  17. } );
  18. }

代码示例来源:origin: io.advantageous.boon/boon-reflekt

  1. public static List<String> readLines( final String location ) {
  2. final String path = getWindowsPathIfNeeded( location );
  3. final URI uri = createURI( path );
  4. return ( List<String> ) Exceptions.tryIt( Typ.list, new Exceptions.TrialWithReturn<List>() {
  5. @Override
  6. public List<String> tryIt() throws Exception {
  7. if ( uri.getScheme() == null ) {
  8. Path thePath = FileSystems.getDefault().getPath( path );
  9. return Files.readAllLines( thePath, DEFAULT_CHARSET );
  10. } else if ( uri.getScheme().equals( FILE_SCHEMA ) ) {
  11. Path thePath = FileSystems.getDefault().getPath( uri.getPath() );
  12. return Files.readAllLines( thePath, DEFAULT_CHARSET );
  13. } else {
  14. return readLines( location, uri );
  15. }
  16. }
  17. } );
  18. }

相关文章