Package org.apache.empire.db
Class DBBlobData
java.lang.Object
org.apache.empire.db.DBBlobData
This class allocates methods to store binary large objects in the database.
-
Constructor Summary
ConstructorsConstructorDescriptionDBBlobData(byte[] data) Constructor for LobData from a byte array.DBBlobData(InputStream inputStream, int length) Constructor to pass LOB data to the setValue methods of a record, consisting of the input stream where the data can be loaded from and the length of the data.DBBlobData(String text) Constructor for LobData from a string.DBBlobData(String text, String encoding) Constructor for LobData from a string. -
Method Summary
Modifier and TypeMethodDescriptionReturns the inputStream with the binary data for the BLOB.intReturns the length of the BLOB data in bytes.static voidsetDefaultEncoding(String defaultEncoding) Sets the defaultEncoding used in a constructor.
-
Constructor Details
-
DBBlobData
Constructor to pass LOB data to the setValue methods of a record, consisting of the input stream where the data can be loaded from and the length of the data.- Parameters:
inputStream- The stream where the data will be read fromlength- The number of bytes to read from the stream- Throws:
IllegalArgumentException- If the inputStream is null
-
DBBlobData
Constructor for LobData from a byte array.- Parameters:
data- The byte array- Throws:
IllegalArgumentException- If the text is null or the encoding is unsupported- See Also:
-
DBBlobData
Constructor for LobData from a string.- Parameters:
text- The string to be used as dataencoding- The encoding of the string. The string must be converted to a byte array to put in the BLOB. It is necessary to convert the string.- Throws:
IllegalArgumentException- If the text is null or the encoding is unsupported- See Also:
-
DBBlobData
Constructor for LobData from a string.- Parameters:
text- The string to be used as data. The encoding is set using setDefaultEncoding- Throws:
IllegalArgumentException- If the text is null or the encoding is unsupported- See Also:
-
-
Method Details
-
getInputStream
Returns the inputStream with the binary data for the BLOB.- Returns:
- Returns the inputStream with the binary data for the BLOB
-
getLength
public int getLength()Returns the length of the BLOB data in bytes.- Returns:
- Returns the length of the BLOB data in bytes
-
setDefaultEncoding
Sets the defaultEncoding used in a constructor.- Parameters:
defaultEncoding- Set the defaultEncoding used in a constructor- See Also:
-