Using DataHandlers
Once you've got the above done, its time to start writing your logic. DataHandlers are easy to use and create. To consume a DataHandler:
Picture picture = ...;
DataHandler handler = picture.getImageData();
InputStream is = handler.getInputStream();
There are many ways to create DataHandlers. You can use a FileDataSource, ByteArrayDataSource, or write your own DataSource:
DataSource source = new ByteArrayDataSource(new byte[] {...},
"content/type");
DataSource source = new FileDataSource(new File("my/file"));
Picture picture = new Picture();
picture.setImageData(new DataHandler(source));