Package io.github.connellite.jdbc
Class LobUtils
java.lang.Object
io.github.connellite.jdbc.LobUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]convertBlobToByteArray(Blob blob) Reads all bytes fromblobviaBlob.getBinaryStream()until end of stream.static StringconvertClobToString(Clob clob) Reads all characters fromclobviaClob.getCharacterStream()preserving original line separators and all other characters.static BlobcreateBlob(byte[] bytes) Creates JDBCBlobfrom a byte array.static ClobcreateClob(char[] chars) Creates JDBCClobfrom a character array.static ClobcreateClob(String s) static NClobcreateNClob(char[] chars) Creates JDBCNClobfrom a character array.static NClob
-
Constructor Details
-
LobUtils
public LobUtils()
-
-
Method Details
-
convertClobToString
Reads all characters fromclobviaClob.getCharacterStream()preserving original line separators and all other characters.- Parameters:
clob- JDBCClob; may benull- Returns:
- full text as stored in the CLOB, or
nullifclobisnull - Throws:
SQLException
-
convertBlobToByteArray
Reads all bytes fromblobviaBlob.getBinaryStream()until end of stream.- Parameters:
blob- JDBCBlob; may benull- Returns:
- a new byte array with the full contents, or
nullifblobisnull - Throws:
SQLException
-
createClob
- Parameters:
s- source text; may benull- Returns:
- a new
Clob, ornullifsisnull - Throws:
SQLException
-
createClob
Creates JDBCClobfrom a character array.- Parameters:
chars- source character array; may benull- Returns:
- a new
Clob, ornullifcharsisnull - Throws:
SQLException
-
createNClob
- Parameters:
s- source text; may benull- Returns:
- a new
NClob, ornullifsisnull - Throws:
SQLException
-
createNClob
Creates JDBCNClobfrom a character array.- Parameters:
chars- source character array; may benull- Returns:
- a new
NClob, ornullifcharsisnull - Throws:
SQLException
-
createBlob
Creates JDBCBlobfrom a byte array.- Parameters:
bytes- source bytes; may benull- Returns:
- a new
Blob, ornullifbytesisnull - Throws:
SQLException
-