|
Oracle interMedia Java Classes API Reference 10g Release 2 (10.2) Part No. B14301-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoracle.ord.im.OrdImageBase
oracle.ord.im.OrdImage
The OrdImage class is used to represent an instance of the ORDSYS.ORDImage database type in a Java application. The OrdImage class includes a set of methods to get and set various object attributes, as well as a set of methods to perform various operations on an OrdImage Java object.
Users of this class should be familiar with Oracle interMedia Reference.
Almost all methods operate on the attributes of the OrdImage Java object in the application. The exceptions are those methods that access the image data for read or write purposes, which are described in the following list:
file
, read data from the specified file.http
, read data from the resource at the specified URL.
Some methods in the OrdImage Java class are handed off to a database
source plug-in for processing; these methods have
byte [] ctx []
as a context parameter. Applications
should allocate a 64-byte array to hold any context information that may be
required by a source plug-in. For example, a plug-in may initialize the
context information in one call and use that information in a subsequent
call. For most plug-ins, 64 bytes should be sufficient. Some user-defined
plug-ins may need additional space. The following example shows how to
allocate a plug-in context information array:
byte [] ctx [] = new byte[1][64];
See Oracle interMedia Reference for more information about plug-ins.
In order to run OrdImage methods, you will need to include the following import statements in your Java file:
import oracle.ord.im.OrdMediaUtil; import oracle.ord.im.OrdImage;
You may also need to import classes from the following Java packages:
java.io. java.sql. oracle.jdbc.
Before running OrdImage methods, the following operations must have already been performed:
For examples of making a connection and populating a local object, see Oracle interMedia User's Guide.
Field Summary |
Fields inherited from class oracle.ord.im.OrdImageBase |
_SQL_NAME, _SQL_TYPECODE |
Constructor Summary | |
OrdImage()
Deprecated. |
Method Summary | |
boolean |
checkProperties()
Checks if the properties of the image data are consistent with the attributes of the OrdImage Java object. |
void |
clearLocal()
Clears the local attribute to indicate that the image data is stored externally. |
void |
copy(OrdImage dest)
Copies an OrdImage Java object. |
oracle.sql.CustomDatum |
create(oracle.sql.Datum d,
int sqlType)
Exists as an internal method used only by the Oracle CustomDatum interface. |
void |
deleteContent()
Deletes any data stored in the database BLOB specified by the localData attribute. |
void |
export(byte[][] ctx,
java.lang.String srcType,
java.lang.String srcLocation,
java.lang.String srcName)
Exports the data from the BLOB specified by the localData attribute. |
oracle.sql.BFILE |
getBFILE()
Returns a BFILE locator from the database when the value of the srcType attribute is file . |
java.lang.String |
getCompressionFormat()
Returns the value of the compressionFormat attribute. |
oracle.sql.BLOB |
getContent()
Returns the BLOB locator from the localData attribute. |
java.lang.String |
getContentFormat()
Returns the value of the contentFormat attribute. |
int |
getContentLength()
Returns the value of the contentLength attribute. |
byte[] |
getDataInByteArray()
Returns a byte array containing the data from the database BLOB specified by the localData attribute. |
boolean |
getDataInFile(java.lang.String filename)
Writes the data from the database BLOB specified by the localData attribute to a local file. |
java.io.InputStream |
getDataInStream()
Returns an InputStream object from which the data in the database BLOB specified by the localData attribute can be read. |
oracle.xdb.XMLType |
getDicomMetadata(java.lang.String optionString)
Returns an XML representation of the metadata extracted from the DICOM image stored in the OrdImage object. |
static oracle.sql.CustomDatumFactory |
getFactory()
Deprecated. New applications should use the getORADataFactory method. |
java.lang.String |
getFormat()
Returns the value of the fileFormat attribute. |
int |
getHeight()
Returns the value of the height attribute. |
oracle.xdb.XMLType[] |
getMetadata(java.lang.String metadataType)
Extracts metadata information from the image as specified by the metadataType parameter. |
java.lang.String |
getMimeType()
Returns the value of the mimeType attribute. |
static oracle.sql.ORADataFactory |
getORADataFactory()
Returns the OrdImage ORADataFactory interface for use by the getORAData method. |
java.lang.String |
getSource()
Returns the source information in the form srcType://srcLocation/srcName . |
java.lang.String |
getSourceLocation()
Returns the value of the srcLocation attribute. |
java.lang.String |
getSourceName()
Returns the value of the srcName attribute. |
java.lang.String |
getSourceType()
Returns the value of the srcType attribute. |
java.sql.Timestamp |
getUpdateTime()
Returns the value of the updateTime attribute. |
int |
getWidth()
Returns the value of the width attribute. |
void |
importData(byte[][] ctx)
Imports data from an external source into the database BLOB specified by the localData attribute. |
void |
importFrom(byte[][] ctx,
java.lang.String srcType,
java.lang.String srcLocation,
java.lang.String srcName)
Imports data from an external source into the database BLOB specified by the localData attribute. |
boolean |
isLocal()
Indicates if the image data is stored locally in the database in a BLOB specified by the localData attribute. |
boolean |
loadDataFromByteArray(byte[] byteArr)
Loads data from a byte array into the database BLOB specified by the localData attribute. |
boolean |
loadDataFromFile(java.lang.String filename)
Loads data from a file into the database BLOB specified by the localData attribute. |
boolean |
loadDataFromInputStream(java.io.InputStream inpStream)
Loads data from an InputStream object into the database BLOB specified by the localData attribute. |
void |
process(java.lang.String cmd)
Performs one or more image processing operations on the image data in the database BLOB specified by the localData attribute. |
void |
processCopy(java.lang.String cmd,
OrdImage dest)
Copies the image data to the destination object and performs one or more image processing operations on the image data. |
void |
putMetadata(oracle.xdb.XMLType xmlData,
java.lang.String metadataType,
java.lang.String encoding)
Embeds the metadata contained in the XML document into the image. |
void |
setCompressionFormat(java.lang.String compressionFormat)
Sets the value of the compressionFormat attribute. |
void |
setContentFormat(java.lang.String contentFormat)
Sets the value of the contentFormat attribute. |
void |
setContentLength(int contentLength)
Sets the value of the contentLength attribute. |
void |
setFormat(java.lang.String fileFormat)
Sets the value of the fileFormat attribute. |
void |
setHeight(int height)
Sets the value of the height attribute. |
void |
setLocal()
Sets the value of the local attribute to indicate that the image data is stored locally in the database in a BLOB specified by the localData attribute. |
void |
setMimeType(java.lang.String mimeType)
Sets the value of the mimeType attribute. |
void |
setProperties()
Parses the image data properties and sets the values of the attributes in the OrdImage Java object. |
void |
setProperties(java.lang.String description)
Writes the characteristics of a foreign image into the appropriate attribute fields. |
void |
setSource(java.lang.String srcType,
java.lang.String srcLocation,
java.lang.String srcName)
Sets the values of the srcType, srcLocation, and srcName attributes. |
void |
setUpdateTime(java.sql.Timestamp currentTime)
Sets the value of the updateTime attribute. |
void |
setWidth(int width)
Sets the value of the width attribute. |
Methods inherited from class oracle.ord.im.OrdImageBase |
create, toDatum, toDatum |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public OrdImage()
Method Detail |
public boolean isLocal() throws java.sql.SQLException
true
if the data is stored locally in the database
in a BLOB; false
otherwise.
java.sql.SQLException
- if an error occurs accessing the local attribute.public void setLocal() throws java.sql.SQLException
java.sql.SQLException
- if an error occurs accessing the local attribute.public void clearLocal() throws java.sql.SQLException
java.sql.SQLException
- if an error occurs accessing the local attribute.public java.lang.String getSourceType() throws java.sql.SQLException
String
.
java.sql.SQLException
- if an error occurs accessing the srcType attribute.public java.lang.String getSourceLocation() throws java.sql.SQLException
String
.
java.sql.SQLException
- if an error occurs accessing the srcLocation
attribute.public java.lang.String getSourceName() throws java.sql.SQLException
String
.
java.sql.SQLException
- if an error occurs accessing the srcName attribute.public java.lang.String getSource() throws java.sql.SQLException
srcType://srcLocation/srcName
.
String
.
java.sql.SQLException
- if an error occurs executing the corresponding
getSource method in the database.public void setSource(java.lang.String srcType, java.lang.String srcLocation, java.lang.String srcName) throws java.sql.SQLException
srcType
- the type of the source.srcLocation
- the location of the source.srcName
- the name of the source.
java.sql.SQLException
- if an error occurs accessing the srcType,
srcLocation, or srcName attributes.public java.sql.Timestamp getUpdateTime() throws java.sql.SQLException
java.sql.Timestamp
object.
java.sql.SQLException
- if an error occurs accessing the updateTime attribute.public void setUpdateTime(java.sql.Timestamp currentTime) throws java.sql.SQLException
null
.
currentTime
- the update time or the null
value, used to
set the value of the updateTime attribute to the current SYSDATE time.
java.sql.SQLException
- if an error occurs executing the corresponding
setUpdateTime method in the database.public oracle.sql.BLOB getContent() throws java.sql.SQLException
oracle.sql.BLOB
locator.
java.sql.SQLException
- if an error occurs accessing the localData attribute.public oracle.sql.BFILE getBFILE() throws java.sql.SQLException
file
. This method calls the corresponding
getBFILE method in the database, which creates the BFILE using the
srcLocation and srcName attributes.
oracle.sql.BFILE
locator.
java.sql.SQLException
- if an error occurs executing the corresponding
getBFILE method in the database.public int getHeight() throws java.sql.SQLException
int
).
java.sql.SQLException
- if an error occurs accessing the height attribute.public void setHeight(int height) throws java.sql.SQLException
The setProperties()
method sets the value of this
attribute automatically for certain image formats; use this method only
if you are not using the setProperties method. This method sets only the
attribute value; it does not modify the image data itself.
height
- the new attribute value.
java.sql.SQLException
- if an error occurs accessing the height attribute.public int getWidth() throws java.sql.SQLException
int
).
java.sql.SQLException
- if an error occurs accessing the width attribute.public void setWidth(int width) throws java.sql.SQLException
The setProperties()
method sets the value of this
attribute automatically for certain image formats; use this method only
if you are not using the setProperties method. This method sets only the
attribute value; it does not modify the image data itself.
width
- the new attribute value.
java.sql.SQLException
- if an error occurs accessing the width attribute.public int getContentLength() throws java.sql.SQLException
int
).
java.sql.SQLException
- if an error occurs accessing the contentLength
attribute.public void setContentLength(int contentLength) throws java.sql.SQLException
The setProperties()
method sets the value of this
attribute automatically for certain image formats; use this method only
if you are not using the setProperties method. This method sets only the
attribute value; it does not modify the image data itself.
contentLength
- the new attribute value.
java.sql.SQLException
- if an error occurs accessing the contentLength
attribute.public java.lang.String getFormat() throws java.sql.SQLException
String
.
java.sql.SQLException
- if an error occurs accessing the fileFormat attribute.public void setFormat(java.lang.String fileFormat) throws java.sql.SQLException
The setProperties()
method sets the value of this
attribute automatically for certain image formats; use this method only
if you are not using the setProperties method. This method sets only the
attribute value; it does not modify the image data itself. Set the value of
the fileFormat attribute to a String
beginning with
other
to disable the automatic call to the setProperties method
by the importData and importFrom methods.
fileFormat
- the new attribute value.
java.sql.SQLException
- if an error occurs accessing the fileFormat attribute.public java.lang.String getContentFormat() throws java.sql.SQLException
String
.
java.sql.SQLException
- if an error occurs accessing the contentFormat
attribute.public void setContentFormat(java.lang.String contentFormat) throws java.sql.SQLException
The setProperties()
method sets the value of this
attribute automatically for certain image formats; use this method only
if you are not using the setProperties method. This method sets only the
attribute value; it does not modify the image data itself.
contentFormat
- the new attribute value.
java.sql.SQLException
- if an error occurs accessing the contentFormat
attribute.public java.lang.String getCompressionFormat() throws java.sql.SQLException
String
.
java.sql.SQLException
- if an error occurs accessing the compressionFormat
attribute.public void setCompressionFormat(java.lang.String compressionFormat) throws java.sql.SQLException
The setProperties()
method sets the value of this
attribute automatically for certain image formats; use this method only
if you are not using the setProperties method. This method sets only the
attribute value; it does not modify the image data itself.
compressionFormat
- the new attribute value.
java.sql.SQLException
- if an error occurs accessing the compressionFormat
attribute.public java.lang.String getMimeType() throws java.sql.SQLException
String
.
java.sql.SQLException
- if an error occurs accessing the mimeType attribute.public void setMimeType(java.lang.String mimeType) throws java.sql.SQLException
The setProperties()
method sets the value of this
attribute automatically for certain image formats; use this method only
if you are not using the setProperties method. This method sets only the
attribute value; it does not modify the image data itself.
mimeType
- the new attribute value.
java.sql.SQLException
- if an error occurs accessing the mimeType attribute.public boolean loadDataFromFile(java.lang.String filename) throws java.sql.SQLException, java.io.IOException
deleteContent()
method to delete any existing data
in the BLOB. It also calls the setLocal()
method to set
the local flag. In addition, this method calls the
setUpdateTime(java.sql.Timestamp)
method to set the value of the
updateTime attribute to the current SYSDATE time.
filename
- the name of the file from which the data will be loaded.
true
if the data is loaded successfully; otherwise,
an exception is raised if an error occurs. This method never
returns false
.
java.sql.SQLException
- if an error occurs accessing an object attribute or
executing a method in the database.
java.io.IOException
- if an error occurs reading the data file.public boolean loadDataFromInputStream(java.io.InputStream inpStream) throws java.sql.SQLException, java.io.IOException
deleteContent()
method to delete any existing
data in the BLOB. It also calls the setLocal()
method
to set the local flag. In addition, this method calls the
setUpdateTime(java.sql.Timestamp)
method to set the value of the
updateTime attribute to the current SYSDATE time.
inpStream
- the name of the InputStream
object from which
the data will be loaded.
true
if the data is loaded successfully; otherwise,
an exception is raised if an error occurs. This method never
returns false
.
java.sql.SQLException
- if an error occurs accessing an object attribute or
executing a method in the database.
java.io.IOException
- if an error occurs reading the InputStream object.public boolean loadDataFromByteArray(byte[] byteArr) throws java.sql.SQLException, java.io.IOException
deleteContent()
method to delete any existing data
in the BLOB. It also calls the setLocal()
method to set
the local flag. In addition, this method calls the
setUpdateTime(java.sql.Timestamp)
method to set the value of the
updateTime attribute to the current SYSDATE time.
byteArr
- the name of the local byte[]
array from which
the data will be loaded.
true
if the data is loaded successfully; otherwise,
an exception is raised if an error occurs. This method never
returns false
.
java.sql.SQLException
- if an error occurs accessing an object attribute or
executing a method in the database.
java.io.IOException
- if an error occurs reading the byte array.public boolean getDataInFile(java.lang.String filename) throws java.sql.SQLException, java.io.IOException
filename
- the name of the file to which the data will be written.
true
if the data is written to the file successfully;
otherwise, an exception is raised if an error occurs. This method
never returns false
.
java.sql.SQLException
- if an error occurs accessing an object attribute.
java.io.IOException
- if an error occurs reading the data from the BLOB or
writing the data to the output file.public java.io.InputStream getDataInStream() throws java.sql.SQLException
InputStream
object from which the data will be read.
java.sql.SQLException
- if an error occurs accessing an object attribute.public byte[] getDataInByteArray() throws java.sql.SQLException, java.io.IOException, java.lang.OutOfMemoryError
byte[]
array containing the data.
java.sql.SQLException
- if an error occurs accessing an object attribute.
java.io.IOException
- if an error occurs reading the data from the BLOB.
java.lang.OutOfMemoryError
- if sufficient memory cannot be allocated to
hold the data.public void deleteContent() throws java.sql.SQLException
java.sql.SQLException
- if an error occurs executing the corresponding
deleteContent method in the database.public void importData(byte[][] ctx) throws java.sql.SQLException
setFormat(java.lang.String)
method to set
the value of the fileFormat attribute to a String
beginning
with other
to disable the automatic call to the
setProperties method.
ctx
- the source plug-in context information.
java.sql.SQLException
- if an error occurs executing the corresponding
import method or the setProperties method in the
database.public void importFrom(byte[][] ctx, java.lang.String srcType, java.lang.String srcLocation, java.lang.String srcName) throws java.sql.SQLException
setFormat(java.lang.String)
method to set the value of the fileFormat
attribute to other
to disable the automatic call to the
setProperties method.
ctx
- the source plug-in context information.srcType
- the source type from which the data will be imported.srcLocation
- the source location from which the data will be imported.srcName
- the source name from which the data will be imported.
java.sql.SQLException
- if an error occurs executing the corresponding
importFrom method or the setProperties method in
the database.public void export(byte[][] ctx, java.lang.String srcType, java.lang.String srcLocation, java.lang.String srcName) throws java.sql.SQLException
Not all source plug-ins support the export method. For example, the "file" source type is the only Oracle-supplied source type that supports the export method.
This method will work only if you are running Oracle release 8.1.7 or later.
The remainder of this description describes the use of the export method and the Oracle-supplied "file" source plug-in. User-written plug-ins will behave differently.
The export method implemented by the Oracle-supplied "file" source plug-in copies, but does not modify, the image data stored in the database BLOB specified by the localData attribute.
After exporting the image data, all the image property attributes remain
unchanged. However, the srcType, srcLocation, and srcName attributes are
updated with values of the srcType, srcLocation, and srcName parameters
passed to the export method. After calling the export method, if you no
longer intend to manage the image data within the database, call the
clearLocal()
method to indicate the image data is stored
outside the database, and call the deleteContent()
method to delete the image data stored in the database BLOB.
See Oracle interMedia Reference for information about the privileges required to write to a database directory object. See Oracle Database Java Developer's Guide and the java.io.FilePermission class in the Java API for information about security and performance.
ctx
- the source plug-in context information.srcType
- the source type to which the content will be exported.srcLocation
- the source location to which the content will be exported.srcName
- the source name to which the content will be exported.
java.sql.SQLException
- if an error occurs executing the corresponding export
method in the database.public void setProperties() throws java.sql.SQLException
null
if
the corresponding property cannot be extracted for a specific image
format. This method throws a SQLException error if the image format is
not recognized.
java.sql.SQLException
- if an error occurs executing the corresponding
setProperties method in the database.public void setProperties(java.lang.String description) throws java.sql.SQLException
description
- a String
that specifies the image
characteristics to set for the foreign image.
java.sql.SQLException
- if an error occurs executing the corresponding
setProperties method in the database.public boolean checkProperties() throws java.sql.SQLException
true
if the properties of the image data are
consistent with the attributes of the OrdImage Java object;
false
otherwise.
java.sql.SQLException
- if an error occurs executing the corresponding
checkProperties method in the database.public void process(java.lang.String cmd) throws java.sql.SQLException
See Oracle interMedia Reference for more information on the various image processing operations that can be performed on an image.
cmd
- a String
that specifies a list of image
processing operations to perform on the image.
java.sql.SQLException
- if an error occurs executing the corresponding
process method in the database.public oracle.xdb.XMLType getDicomMetadata(java.lang.String optionString) throws java.sql.SQLException
See the following appendixes in Oracle interMedia Reference:
See Oracle interMedia User's Guide for more information about the DICOM feature.
optionString
- a String
that specifies the type of
DICOM metadata to extract. For this release, the only valid
value is imageGeneral
. All other values are
ignored.
java.sql.SQLException
- if an error occurs executing the corresponding
getDicomMetadata method in the database.public void copy(OrdImage dest) throws java.sql.SQLException
dest
- the destination OrdImage
object to which the
data will be copied.
java.sql.SQLException
- if an error occurs calling the corresponding copy
method in the database.public void processCopy(java.lang.String cmd, OrdImage dest) throws java.sql.SQLException
cmd
- a String
that specifies a list of image
processing operations to perform on the image.dest
- the destination OrdImage
object.
java.sql.SQLException
- if an error occurs calling the corresponding
processCopy method in the database.public oracle.xdb.XMLType[] getMetadata(java.lang.String metadataType) throws java.sql.SQLException
See Oracle interMedia User's Guide and Oracle interMedia Reference for more information about the Metadata feature.
metadataType
- a String
that specifies the types of
embedded metadata to extract. Valid values are ALL
,
ORDIMAGE
, XMP
, EXIF
, and
IPTC-IIM
.
java.sql.SQLException
- if an error occurs extracting the metadata.public void putMetadata(oracle.xdb.XMLType xmlData, java.lang.String metadataType, java.lang.String encoding) throws java.sql.SQLException
This method accepts a schema valid XML document and creates a binary packet suitable for embedding in the target image file format. The packet is encoded according to the value of the encoding parameter. If the value of the metadataType parameter is XMP, a new Extensible Metadata Platform (XMP) packet is written to the image, replacing any existing XMP packets.
See Oracle interMedia User's Guide and Oracle interMedia Reference for more information about the Metadata feature.
xmlData
- an instance of oracle.xdb.XMLType
. The
XML document must be schema valid for the indicated metadataType parameter.
If the value of the metadataType parameter is XMP
, the root
element should contain a well-formed Resource Description Framework (RDF)
document.metadataType
- a String
that specifies the type
of metadata to be written. The valid value is XMP
.encoding
- a String
that specifies the character
encoding to be used in the image file. Valid values are
UTF-8
, UTF-16
, UTF-16BE
, and
UTF-16LE
. UTF-16
is the same as
UTF-16BE
.
java.sql.SQLException
- if an error occurs writing the metadata.public static oracle.sql.ORADataFactory getORADataFactory()
public static oracle.sql.CustomDatumFactory getFactory()
public oracle.sql.CustomDatum create(oracle.sql.Datum d, int sqlType) throws java.sql.SQLException
java.sql.SQLException
|
Oracle interMedia Java Classes API Reference 10g Release 2 (10.2) Part No. B14301-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |