Class LobUtils

java.lang.Object
io.github.connellite.jdbc.LobUtils

public class LobUtils extends Object
  • Constructor Details

    • LobUtils

      public LobUtils()
  • Method Details

    • convertClobToString

      public static String convertClobToString(Clob clob) throws SQLException
      Reads all characters from clob via Clob.getCharacterStream() preserving original line separators and all other characters.
      Parameters:
      clob - JDBC Clob; may be null
      Returns:
      full text as stored in the CLOB, or null if clob is null
      Throws:
      SQLException
    • convertBlobToByteArray

      public static byte[] convertBlobToByteArray(Blob blob) throws SQLException
      Reads all bytes from blob via Blob.getBinaryStream() until end of stream.
      Parameters:
      blob - JDBC Blob; may be null
      Returns:
      a new byte array with the full contents, or null if blob is null
      Throws:
      SQLException
    • createClob

      public static Clob createClob(String s) throws SQLException
      Creates JDBC Clob from a String.
      Parameters:
      s - source text; may be null
      Returns:
      a new Clob, or null if s is null
      Throws:
      SQLException
    • createClob

      public static Clob createClob(char[] chars) throws SQLException
      Creates JDBC Clob from a character array.
      Parameters:
      chars - source character array; may be null
      Returns:
      a new Clob, or null if chars is null
      Throws:
      SQLException
    • createNClob

      public static NClob createNClob(String s) throws SQLException
      Creates JDBC NClob from a String.
      Parameters:
      s - source text; may be null
      Returns:
      a new NClob, or null if s is null
      Throws:
      SQLException
    • createNClob

      public static NClob createNClob(char[] chars) throws SQLException
      Creates JDBC NClob from a character array.
      Parameters:
      chars - source character array; may be null
      Returns:
      a new NClob, or null if chars is null
      Throws:
      SQLException
    • createBlob

      public static Blob createBlob(byte[] bytes) throws SQLException
      Creates JDBC Blob from a byte array.
      Parameters:
      bytes - source bytes; may be null
      Returns:
      a new Blob, or null if bytes is null
      Throws:
      SQLException