Module org.jooq
Package org.jooq

Class Source

java.lang.Object
org.jooq.Source

public final class Source extends Object
A source of text data.
  • Method Summary

    Modifier and Type
    Method
    Description
    final @Nullable File
    The file if this is a File based source, or null if no file is available.
    final @Nullable String
    The name of the file if this is a File based source, or null if no name is available.
    static final Source
    of(byte[] bytes)
    Create a source from binary data.
    static final Source
    of(byte[] bytes, String charsetName)
    Create a source from binary data using a specific character set.
    static final Source
    of(byte[] bytes, Charset charset)
    Create a source from binary data using a specific character set.
    static final Source
    of(byte[] bytes, CharsetDecoder charsetDecoder)
    Create a source from binary data using a specific character set.
    static final Source
    of(File file)
    Create a source from a file.
    static final Source
    of(File file, String charsetName)
    Create a source from a file using a specific character set.
    static final Source
    of(File file, Charset charset)
    Create a source from a file using a specific character set.
    static final Source
    of(File file, CharsetDecoder charsetDecoder)
    Create a source from a file using a specific character set.
    static final Source
    of(InputStream inputStream)
    Create a source from an input stream.
    static final Source
    of(InputStream inputStream, int length)
    Create a source from an input stream.
    static final Source
    of(InputStream inputStream, int length, String charsetName)
    Create a source from an input stream using a specific character set.
    static final Source
    of(InputStream inputStream, int length, Charset charset)
    Create a source from an input stream using a specific character set.
    static final Source
    of(InputStream inputStream, int length, CharsetDecoder charsetDecoder)
    Create a source from an input stream using a specific character set.
    static final Source
    of(InputStream inputStream, String charsetName)
    Create a source from an input stream using a specific character set.
    static final Source
    of(InputStream inputStream, Charset charset)
    Create a source from an input stream using a specific character set.
    static final Source
    of(InputStream inputStream, CharsetDecoder charsetDecoder)
    Create a source from an input stream using a specific character set.
    static final Source
    of(Reader reader)
    Create a source from a reader.
    static final Source
    of(Reader reader, int length)
    Create a source from a reader.
    static final Source
    of(String string)
    Create a source from a string.
    final @NotNull Reader
    Produce a reader from this source.
    final @NotNull String
    Read the entire reader() into a String, for convenience.
    static final Source
    resolve(String string)
    Create a source from a string that may represent a resource.
    static final Source
    resolve(String string, String charsetName)
    Create a source from a string that may represent a resource using a specific character set.
    static final Source
    resolve(String string, Charset charset)
    Create a source from a string that may represent a resource using a specific character set.
    static final Source
    resolve(String string, CharsetDecoder charsetDecoder)
    Create a source from a string that may represent a resource using a specific character set.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • resolve

      public static final Source resolve(String string)
      Create a source from a string that may represent a resource.

      The following resource types are attempted to be resolved, in order:

      • A classpath resource
      • A file system resource
      • A non-resource string (see of(String))

      Note that if users expect a resource descriptor to resolve, but the resource is not found, instead of throwing an exception on reader() or readString(), this will just produce the input string again, as if of(String) was called.

    • resolve

      public static final Source resolve(String string, String charsetName)
      Create a source from a string that may represent a resource using a specific character set.

      The following resource types are attempted to be resolved, in order:

      • A classpath resource
      • A file system resource
      • A non-resource string (see of(String))

      Note that if users expect a resource descriptor to resolve, but the resource is not found, instead of throwing an exception on reader() or readString(), this will just produce the input string again, as if of(String) was called.

    • resolve

      public static final Source resolve(String string, Charset charset)
      Create a source from a string that may represent a resource using a specific character set.

      The following resource types are attempted to be resolved, in order:

      • A classpath resource
      • A file system resource
      • A non-resource string (see of(String))

      Note that if users expect a resource descriptor to resolve, but the resource is not found, instead of throwing an exception on reader() or readString(), this will just produce the input string again, as if of(String) was called.

    • resolve

      public static final Source resolve(String string, CharsetDecoder charsetDecoder)
      Create a source from a string that may represent a resource using a specific character set.

      The following resource types are attempted to be resolved, in order:

      • A classpath resource
      • A file system resource
      • A non-resource string (see of(String))

      Note that if users expect a resource descriptor to resolve, but the resource is not found, instead of throwing an exception on reader() or readString(), this will just produce the input string again, as if of(String) was called.

    • of

      public static final Source of(String string)
      Create a source from a string.
    • of

      public static final Source of(byte[] bytes)
      Create a source from binary data.
    • of

      public static final Source of(byte[] bytes, String charsetName)
      Create a source from binary data using a specific character set.
    • of

      public static final Source of(byte[] bytes, Charset charset)
      Create a source from binary data using a specific character set.
    • of

      public static final Source of(byte[] bytes, CharsetDecoder charsetDecoder)
      Create a source from binary data using a specific character set.
    • of

      public static final Source of(File file)
      Create a source from a file.
    • of

      public static final Source of(File file, String charsetName)
      Create a source from a file using a specific character set.
    • of

      public static final Source of(File file, Charset charset)
      Create a source from a file using a specific character set.
    • of

      public static final Source of(File file, CharsetDecoder charsetDecoder)
      Create a source from a file using a specific character set.
    • of

      public static final Source of(Reader reader)
      Create a source from a reader.
    • of

      public static final Source of(Reader reader, int length)
      Create a source from a reader.
    • of

      public static final Source of(InputStream inputStream)
      Create a source from an input stream.
    • of

      public static final Source of(InputStream inputStream, String charsetName)
      Create a source from an input stream using a specific character set.
    • of

      public static final Source of(InputStream inputStream, Charset charset)
      Create a source from an input stream using a specific character set.
    • of

      public static final Source of(InputStream inputStream, CharsetDecoder charsetDecoder)
      Create a source from an input stream using a specific character set.
    • of

      public static final Source of(InputStream inputStream, int length)
      Create a source from an input stream.
    • of

      public static final Source of(InputStream inputStream, int length, String charsetName)
      Create a source from an input stream using a specific character set.
    • of

      public static final Source of(InputStream inputStream, int length, Charset charset)
      Create a source from an input stream using a specific character set.
    • of

      public static final Source of(InputStream inputStream, int length, CharsetDecoder charsetDecoder)
      Create a source from an input stream using a specific character set.
    • name

      @Nullable public final @Nullable String name()
      The name of the file if this is a File based source, or null if no name is available.
    • file

      @Nullable public final @Nullable File file()
      The file if this is a File based source, or null if no file is available.
    • reader

      @NotNull public final @NotNull Reader reader() throws IOException
      Produce a reader from this source.
      Throws:
      IOException - When something goes wrong creating a reader from this source.
    • readString

      @NotNull public final @NotNull String readString() throws IOException
      Read the entire reader() into a String, for convenience.
      Throws:
      IOException - When something goes wrong creating a reader from this source.
    • toString

      public String toString()
      Overrides:
      toString in class Object