Class Resources

java.lang.Object
de.sormuras.bach.Resources

public class Resources
extends java.lang.Object
Uniform Resource Identifier (URI) read and download support.
  • Constructor Summary

    Constructors 
    Constructor Description
    Resources​(Log log, java.net.http.HttpClient http)  
  • Method Summary

    Modifier and Type Method Description
    java.nio.file.Path copy​(java.net.URI uri, java.nio.file.Path path, java.nio.file.CopyOption... options)
    Copy all content from a uri to a target file.
    java.net.http.HttpResponse<java.lang.Void> head​(java.net.URI uri, int timeout)  
    static Resources ofSystem()  
    java.lang.String read​(java.net.URI uri)
    Read all content from a uri into a string.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Resources

      public Resources​(Log log, java.net.http.HttpClient http)
  • Method Details

    • ofSystem

      public static Resources ofSystem()
    • head

      public java.net.http.HttpResponse<java.lang.Void> head​(java.net.URI uri, int timeout) throws java.io.IOException, java.lang.InterruptedException
      Throws:
      java.io.IOException
      java.lang.InterruptedException
    • copy

      public java.nio.file.Path copy​(java.net.URI uri, java.nio.file.Path path, java.nio.file.CopyOption... options) throws java.lang.Exception
      Copy all content from a uri to a target file.
      Throws:
      java.lang.Exception
    • read

      public java.lang.String read​(java.net.URI uri) throws java.io.IOException, java.lang.InterruptedException
      Read all content from a uri into a string.
      Throws:
      java.io.IOException
      java.lang.InterruptedException