Clob
Represents a character large object.
Conceptually you can consider it as a set of characters (an RTF or XML document, for example), though in fact it wraps three pieces of information:
-
the set of characters
-
a name
-
a mime type
API
class Clob {
Clob(String name, String primaryType, String subType, char[] chars)
Clob(String name, String mimeTypeBase, char[] chars)
Clob(String name, MimeType mimeType, char[] chars)
Clob(String name, String primaryType, String subType, CharSequence chars)
Clob(String name, String mimeTypeBase, CharSequence chars)
Clob(String name, MimeType mimeType, CharSequence chars)
Clob of(String name, CommonMimeType mimeType, CharSequence content) (1)
Try<Clob> tryRead(String name, CommonMimeType mimeType, DataSource dataSource, Charset charset) (2)
Try<Clob> tryRead(String name, CommonMimeType mimeType, File file, Charset charset) (3)
Try<Clob> tryReadUtf8(String name, CommonMimeType mimeType, File file) (4)
String getName()
MimeType getMimeType()
CharSequence getChars()
Blob toBlob(Charset charset) (5)
Blob toBlobUtf8() (6)
void writeCharsTo(Writer wr)
void writeTo(File file, Charset charset) (7)
void writeToUtf8(File file) (8)
String asString()
boolean equals(Object o)
int hashCode()
String toString()
}
1 | of(String, CommonMimeType, CharSequence)
Returns a new Clob of given name , mimeType and content . |
2 | tryRead(String, CommonMimeType, DataSource, Charset) |
3 | tryRead(String, CommonMimeType, File, Charset)
Shortcut for tryRead(name, mimeType, DataSource.ofFile(file), charset) |
4 | tryReadUtf8(String, CommonMimeType, File)
Shortcut for #tryRead(String, org.apache.causeway.applib.value.NamedWithMimeType.CommonMimeType, File, Charset) using StandardCharsets#UTF_8 . |
5 | toBlob(Charset)
Converts to a Blob , using given Charset for the underlying String to byte[] conversion. |
6 | toBlobUtf8()
Shortcut for #toBlob(Charset) using StandardCharsets#UTF_8 . |
7 | writeTo(File, Charset)
Writes this Clob to the file represented by the specified |
8 | writeToUtf8(File)
Shortcut for #writeTo(File, Charset) using StandardCharsets#UTF_8 . |
Members
of(String, CommonMimeType, CharSequence)
Returns a new Clob of given name , mimeType and content .
name may or may not include the desired filename extension, as it is guaranteed, that the resulting Clob has the appropriate extension as constraint by the given mimeType .
For more fine-grained control use one of the Clob constructors directly.
tryRead(String, CommonMimeType, DataSource, Charset)
name may or may not include the desired filename extension, as it is guaranteed, that the resulting Clob has the appropriate extension as constraint by the given mimeType .
For more fine-grained control use one of the Clob constructors directly.
tryRead(String, CommonMimeType, File, Charset)
Shortcut for tryRead(name, mimeType, DataSource.ofFile(file), charset)
tryReadUtf8(String, CommonMimeType, File)
Shortcut for #tryRead(String, org.apache.causeway.applib.value.NamedWithMimeType.CommonMimeType, File, Charset) using StandardCharsets#UTF_8 .
toBlob(Charset)
Converts to a Blob , using given Charset for the underlying String to byte[] conversion.
writeTo(File, Charset)
Writes this Clob to the file represented by the specified File
object.
If the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other reason then a FileNotFoundException
is thrown.
Usage Notes
If using JDO/DataNucleus, Clob
properties can be mapped using:
@javax.jdo.annotations.Persistent(defaultFetchGroup="false", columns = {
@javax.jdo.annotations.Column(name = "doc_name"),
@javax.jdo.annotations.Column(name = "doc_mimetype"),
@javax.jdo.annotations.Column(name = "doc_chars", jdbcType = "CLOB", sqlType = "CLOB")
})
@Property( optionality = Optionality.OPTIONAL )
@Getter @Setter
private Clob doc;
If the property is mandatory, add allowsNull = "false
for each of the @Column
s.