org.apache.empire.db
Class DBBlobData

java.lang.Object
  extended by org.apache.empire.db.DBBlobData

public class DBBlobData
extends Object

This class allocates methods to store binary large objects in the database.


Constructor Summary
DBBlobData(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
 InputStream getInputStream()
          Returns the inputStream with the binary data for the BLOB.
 int getLength()
          Returns the length of the BLOB data in bytes.
static void setDefaultEncoding(String defaultEncoding)
          Sets the defaultEncoding used in a constructor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBBlobData

public DBBlobData(InputStream inputStream,
                  int length)
           throws IllegalArgumentException
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 from
length - The number of bytes to read from the stream
Throws:
IllegalArgumentException - If the inputStream is null

DBBlobData

public DBBlobData(byte[] data)
           throws IllegalArgumentException
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:
String.getBytes(java.lang.String)

DBBlobData

public DBBlobData(String text,
                  String encoding)
           throws IllegalArgumentException
Constructor for LobData from a string.

Parameters:
text - The string to be used as data
encoding - 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:
String.getBytes(java.lang.String)

DBBlobData

public DBBlobData(String text)
           throws IllegalArgumentException
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:
String.getBytes(java.lang.String)
Method Detail

getInputStream

public InputStream 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

public static void setDefaultEncoding(String defaultEncoding)
Sets the defaultEncoding used in a constructor.

Parameters:
defaultEncoding - Set the defaultEncoding used in a constructor
See Also:
DBBlobData(String)


Copyright © 2008–2014 Apache Software Foundation. All rights reserved.