Class PathReaderBuilder

java.lang.Object
org.apache.juneau.common.utils.PathReaderBuilder

public class PathReaderBuilder extends Object
Utility class for creating Path-based Reader objects.
Since:
9.1.0
  • Constructor Details

  • Method Details

    • create

      public static PathReaderBuilder create()
      Creates a new builder.
      Returns:
      A new builder.
    • create

      public static PathReaderBuilder create(Path path)
      Creates a new builder initialized with the specified path.
      Parameters:
      path - The path being written to.
      Returns:
      A new builder.
    • allowNoFile

      If called and the path is null or non-existent, then the build() command will return an empty reader instead of a IOException.
      Returns:
      This object.
    • build

      public Reader build() throws IOException
      Creates a new File reader.
      Returns:
      A new File reader.
      Throws:
      IOException - if an I/O error occurs opening the path
    • charset

      public PathReaderBuilder charset(Charset charset)
      Sets the character encoding of the path.
      Parameters:
      charset - The character encoding. The default is Charset.defaultCharset(). Null resets to the default.
      Returns:
      This object.
    • charset

      public PathReaderBuilder charset(String charset)
      Sets the character encoding of the path.
      Parameters:
      charset - The character encoding. The default is Charset.defaultCharset(). Null resets to the default.
      Returns:
      This object.
    • path

      public PathReaderBuilder path(Path path)
      Sets the path being written from.
      Parameters:
      path - The path being written from.
      Returns:
      This object.
    • path

      public PathReaderBuilder path(String path)
      Sets the path of the path being written from.
      Parameters:
      path - The path of the path being written from.
      Returns:
      This object.