Package nbbrd.io

Class Resource

java.lang.Object
nbbrd.io.Resource

public class Resource extends Object
Author:
Philippe Charles
  • Constructor Details

    • Resource

      public Resource()
  • Method Details

    • getFile

      @NonNull public @NonNull Optional<File> getFile(@NonNull @NonNull Path path)
      Returns a File object representing this path. Where this Path is associated with the default provider, then this method is equivalent to returning a File object constructed with the String representation of this path.

      If this path was created by invoking the File toPath method then there is no guarantee that the File object returned by this method is equal to the original File.

      Parameters:
      path -
      Returns:
      an optional File object representing this path if associated with the default provider
    • getResourceAsStream

      @Deprecated @NonNull public @NonNull Optional<InputStream> getResourceAsStream(@NonNull @NonNull Class<?> anchor, @NonNull @NonNull String name)
      Deprecated.
    • newInputStream

      @NonNull public static @NonNull InputStream newInputStream(@NonNull @NonNull Class<?> anchor, @NonNull @NonNull String name) throws IOException
      Throws:
      IOException
    • ensureClosed

      public void ensureClosed(@NonNull @NonNull Throwable exception, @Nullable Closeable closeable)
    • closeBoth

      public void closeBoth(@Nullable Closeable first, @Nullable Closeable second) throws IOException
      Throws:
      IOException
    • process

      public void process(@NonNull @NonNull URI uri, @NonNull @NonNull IOConsumer<? super Path> action) throws IOException
      Process a classpath resource as a Path.
      Parameters:
      uri -
      action -
      Throws:
      IOException
      See Also:
    • uncloseableInputStream

      @NonNull public static @NonNull InputStream uncloseableInputStream(@NonNull @NonNull InputStream delegate)
    • uncloseableOutputStream

      @NonNull public static @NonNull OutputStream uncloseableOutputStream(@NonNull @NonNull OutputStream delegate)