Enum Class SampleDocument
- All Implemented Interfaces:
Serializable, Comparable<SampleDocument>, Constable
Curated set of well-known sample documents bundled into the sidecar JAR
for quick testing without needing a repository or manual upload.
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionLewis Carroll's classic novel, as plain text.Apple quarterly financial statements, as a PDF.Vaswani et al.Full text of the King James Bible, as plain text — a large stress-test corpus.Short story, as plain text.U.S.Jane Austen's novel, as plain text.Short news-style article, as plain text.Full text of the United States Constitution, as plain text. -
Method Summary
Modifier and TypeMethodDescriptionstatic SampleDocumentResolves a sample document from itsid(the enum constant name).Returns the human-readable description of this sample document.Returns the bundled resource file name (without the directory prefix).Returns the MIME type of the bundled file (e.g.Returns the full classpath resource path of the bundled file, formed by prefixing the file name with the sample-data directory.longReturns the size of the bundled file in bytes.getTitle()Returns the human-readable display title of this sample document.byte[]Loads the full contents of this sample's bundled file from the thread-context classloader.toInfo()Builds a metadata map describing this sample document, suitable for JSON serialization.static SampleDocumentReturns the enum constant of this class with the specified name.static SampleDocument[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ALICE_IN_WONDERLAND
Lewis Carroll's classic novel, as plain text. -
PRIDE_AND_PREJUDICE
Jane Austen's novel, as plain text. -
US_CONSTITUTION
Full text of the United States Constitution, as plain text. -
SAMPLE_ARTICLE
Short news-style article, as plain text. -
CATH_AND_BRAZZ
Short story, as plain text. -
ATTENTION_PAPER
Vaswani et al. 2017 transformer paper, as a PDF. -
APPLE_FINANCIALS
Apple quarterly financial statements, as a PDF. -
IRS_1040
U.S. individual income tax return form, as a PDF. -
BIBLE_KJV
Full text of the King James Bible, as plain text — a large stress-test corpus.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getTitle
Returns the human-readable display title of this sample document.- Returns:
- the display title
-
getFileName
Returns the bundled resource file name (without the directory prefix).- Returns:
- the file name
-
getSizeBytes
public long getSizeBytes()Returns the size of the bundled file in bytes.- Returns:
- the size in bytes
-
getMimeType
Returns the MIME type of the bundled file (e.g.text/plainorapplication/pdf).- Returns:
- the MIME type
-
getDescription
Returns the human-readable description of this sample document.- Returns:
- the description
-
getResourcePath
Returns the full classpath resource path of the bundled file, formed by prefixing the file name with the sample-data directory.- Returns:
- the classpath resource path
-
loadBytes
Loads the full contents of this sample's bundled file from the thread-context classloader.- Returns:
- the file contents as a byte array
- Throws:
IOException- if the resource is not present on the classpath or cannot be read
-
toInfo
-
fromId
Resolves a sample document from itsid(the enum constant name).- Parameters:
id- the enum constant name to look up- Returns:
- the matching sample document
- Throws:
IllegalArgumentException- ifidmatches no constant; the message lists the valid ids
-