FileDocCategorySizeDatePackage
ImageDataSource.javaAPI DocApache Axis 1.42664Sat Apr 22 18:57:28 BST 2006org.apache.axis.attachments

ImageDataSource

public 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.StringgetContentType()

        return contentType;
    
public java.io.InputStreamgetInputStream()

        if (os.size() != 0) {
            data = os.toByteArray();
            os.reset();
        }
        return new ByteArrayInputStream(data == null ? new byte[0] : data);
    
public java.lang.StringgetName()

        return name;
    
public java.io.OutputStreamgetOutputStream()

        if (os.size() != 0) {
            data = os.toByteArray();
            os.reset();
        }
        return os;