Class LobStreamDataHelper
java.lang.Object
org.hibernate.type.descriptor.java.LobStreamDataHelper
A help for dealing with BLOB and CLOB data
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
extractBytes
(InputStream inputStream) Extract by bytes from the given stream.static byte[]
extractBytes
(InputStream inputStream, long start, int length) Extract a portion of the bytes from the given stream.static String
extractString
(Reader reader) Extract the contents of the given reader/stream as a string.static String
extractString
(Reader reader, int lengthHint) Extract the contents of the given reader/stream as a string.static String
extractString
(Clob value) Extract the contents of the given Clob as a string.static boolean
static InputStream
subStream
(InputStream inputStream, long start, int length) Extract a portion of the bytes from the given stream., wrapping them in a new stream.static Object
Extract a portion of a reader, wrapping the portion in a new reader.
-
Method Details
-
isNClob
-
extractString
Extract the contents of the given reader/stream as a string. The reader will be closed.- Parameters:
reader
- The reader for the content- Returns:
- The content as string
-
extractString
Extract the contents of the given reader/stream as a string. The reader will be closed.- Parameters:
reader
- The reader for the contentlengthHint
- if the length is known in advance the implementation can be slightly more efficient- Returns:
- The content as string
-
subStream
Extract a portion of a reader, wrapping the portion in a new reader.- Parameters:
characterStream
- The reader for the contentstart
- The start position/offset (0-based, per general stream/reader contracts).length
- The amount to extract- Returns:
- The content portion as a reader
-
extractBytes
Extract by bytes from the given stream.- Parameters:
inputStream
- The stream of bytes.- Returns:
- The contents as a
byte[]
-
extractBytes
Extract a portion of the bytes from the given stream.- Parameters:
inputStream
- The stream of bytes.start
- The start position/offset (0-based, per general stream/reader contracts).length
- The amount to extract- Returns:
- The extracted bytes
-
subStream
Extract a portion of the bytes from the given stream., wrapping them in a new stream.- Parameters:
inputStream
- The stream of bytes.start
- The start position/offset (0-based, per general stream/reader contracts).length
- The amount to extract- Returns:
- The extracted bytes as a stream
-
extractString
Extract the contents of the given Clob as a string.- Parameters:
value
- The clob to to be extracted from- Returns:
- The content as string
-