ImageDataSourcepublic class ImageDataSource extends Object implements DataSource
Fields Summary |
---|
protected static Log | log | public static final String | CONTENT_TYPE | private final String | name | private final String | contentType | private byte[] | data | private ByteArrayOutputStream | os |
Constructors Summary |
---|
public ImageDataSource(String name, Image data)
this(name, CONTENT_TYPE, data);
| public ImageDataSource(String name, String contentType, Image data)
this.name = name;
this.contentType = contentType == null ? CONTENT_TYPE : contentType;
os = new ByteArrayOutputStream();
try {
if (data != null) {
ImageIOFactory.getImageIO().saveImage(this.contentType, data, os);
}
}
catch (Exception e) {
log.error(Messages.getMessage("exception00"), e);
}
|
Methods Summary |
---|
public java.lang.String | getContentType()
return contentType;
| public java.io.InputStream | getInputStream()
if (os.size() != 0) {
data = os.toByteArray();
os.reset();
}
return new ByteArrayInputStream(data == null ? new byte[0] : data);
| public java.lang.String | getName()
return name;
| public java.io.OutputStream | getOutputStream()
if (os.size() != 0) {
data = os.toByteArray();
os.reset();
}
return os;
|
|