Class IOUtils

java.lang.Object
panda.utilities.IOUtils

public final class IOUtils extends Object
  • Field Details

  • Method Details

    • fetchContent

      public static panda.std.Result<String,IOException> fetchContent(String url)
      Fetch content of the given website
      Parameters:
      url - the website to fetch
      Returns:
      content of requested page or thrown exception
    • fetchContentAsStream

      public static panda.std.Result<InputStream,IOException> fetchContentAsStream(String url)
      Fetch content of the given website
      Parameters:
      url - the website to fetch
      Returns:
      content of requested page or thrown exception
    • convertStringToStream

      public static InputStream convertStringToStream(String str)
      Parameters:
      str - the string to convert
      Returns:
      the result input stream
    • convertStreamToString

      public static panda.std.Result<String,IOException> convertStreamToString(InputStream inputStream)
      Parameters:
      inputStream - the input stream to convert
      Returns:
      converted string or thrown exception
    • convertStreamToString

      public static panda.std.Result<String,IOException> convertStreamToString(InputStream inputStream, Charset encoding)
      Convert InputStream to String
      Parameters:
      inputStream - the input stream to convert
      encoding - the encoding to use
      Returns:
      converted string or thrown exception
    • close

      public static void close(@Nullable @Nullable Closeable closeable)
      Parameters:
      closeable - nullable resource to close
    • close

      public static void close(@Nullable @Nullable Closeable closeable, @Nullable @Nullable Consumer<IOException> exceptionConsumer)
      Null-safe close operation
      Parameters:
      closeable - nullable resource to close
      exceptionConsumer - nullable exception consumer