Re: Sending image into BLOL

From: Lee Fesperman (firstsql_at_ix.netcom.com)
Date: 10/21/03


Date: Tue, 21 Oct 2003 05:24:18 GMT

Niki Iv wrote:
>
> Hello to All.
> The situation is as follows.
> I use javax.swing.filechooser.FileSystemView
> getSystemIcon to get the default OS icon.
> Now I need to send this Icon to a BLOB
> into database depending on it's extension.
> I don't knwo how to get BLOB (this is interface) instance
> from any suitable class. My first idea was to use PreparedStatement
> and setBlob().
> The second guess was to use
> PreparedStatement.setBinaryStream.. but I was unable to
> figure out how to get InputStream without writing the Image into file
> and then read this file.
> The third guess is to serialize the IconImage whch is serializable..
> but for setBinaryStream I need InputStream.. serializing give me
> output stream..
> Any ideas.....

Send either OutputStream to a ByteArrayOutputStream and then create a
ByteArrayInputStream from the resulting byte[] (retrieved using toByteArray() in
ByteArrayOutputStream).

-- 
Lee Fesperman, FirstSQL, Inc. (http://www.firstsql.com)
==============================================================
* The Ultimate DBMS is here!
* FirstSQL/J Object/Relational DBMS  (http://www.firstsql.com)


Relevant Pages

  • Re: Icon transparency after Serialization
    ... > I would not serialize a reference to a gdiplus icon. ... > When you need to create the Icon (i.e., HICON) use the function ... >> Public Sub New ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Icon transparency after Serialization
    ... to a BI_RGB bitmap because by design ... a BITMAPV5HEADER which supports alpha channels. ... serialize the icon in its own format. ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Icon transparency after Serialization
    ... I would not serialize a reference to a gdiplus icon. ... When you need to create the Icon (i.e., HICON) use the function ... > Public Sub New ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Icon transparency after Serialization
    ... the Icons Masks. ... Icon using this class, it displays fine. ... save as blob) and then redisplay it has lost the alpha ... >> I can serialize, compress and write to the blob field of a database. ...
    (microsoft.public.dotnet.framework.drawing)