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

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

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

IO.createURI介绍

暂无

代码示例

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

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

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

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

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

  1. public static String read( final String location ) {
  2. final URI uri = IO.createURI(location);
  3. return Exceptions.tryIt( String.class, new Exceptions.TrialWithReturn<String>() {
  4. @Override
  5. public String tryIt() throws Exception {
  6. String path = location;
  7. path = IO.getWindowsPathIfNeeded(path);
  8. if ( uri.getScheme() == null ) {
  9. Path thePath = FileSystems.getDefault().getPath( path );
  10. return IO.read(Files.newBufferedReader(thePath, IO.DEFAULT_CHARSET));
  11. } else if ( uri.getScheme().equals( IO.FILE_SCHEMA ) ) {
  12. return IO.readFromFileSchema(uri);
  13. } else if ( uri.getScheme().equals( CLASSPATH_SCHEMA )
  14. || uri.getScheme().equals( IO.JAR_SCHEMA ) ) {
  15. return readFromClasspath( uri.toString() );
  16. } else {
  17. return IO.read(location, uri);
  18. }
  19. }
  20. } );
  21. }

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

  1. private static void resourcesFromFileSystem( List<String> resourcePaths, URL u ) {
  2. URI fileURI = IO.createURI(u.toString());
  3. add( resourcePaths, IO.uriToPath( fileURI ).toString() );
  4. }

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

  1. private static void pathsFromFileSystem( List<Path> resourcePaths, URL u ) {
  2. URI fileURI = IO.createURI( u.toString() );
  3. add( resourcePaths, IO.uriToPath( fileURI ) );
  4. }

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

  1. public static void eachLine( final String location, final EachLine eachLine ) {
  2. final URI uri = createURI( location );

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

  1. public static void eachLine( final String location, final EachLine eachLine ) {
  2. final URI uri = createURI( location );

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

  1. public static String readResource( final String location ) {
  2. final URI uri = IO.createURI(location);

代码示例来源: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. }

代码示例来源: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. }

相关文章