/*
 * TaminoMimeMessageSource.java
 *
 * Created on 21. April 2002, 18:31
 */

package org.apache.james.mailrepository;

/**
 *
 * @author  hch
 */
public class TaminoMimeMessageSource extends org.apache.james.core.MimeMessageSource {
    protected org.w3c.dom.Element message;    
    
    /** Creates a new instance of TaminoMimeMessageSource */
    public TaminoMimeMessageSource(org.w3c.dom.Element message) {
        this.message = message;
    }
    
    /**
     * Return an input stream to the data
     */
    public java.io.InputStream getInputStream() throws java.io.IOException {
        org.w3c.dom.Element header = (org.w3c.dom.Element)chaudhuri.util.DOMUtil.getChildByTagName(message, "header");
        org.w3c.dom.Element body = (org.w3c.dom.Element)chaudhuri.util.DOMUtil.getChildByTagName(message, "body");
        java.io.ByteArrayInputStream headerin = new java.io.ByteArrayInputStream(chaudhuri.util.DOMUtil.getContentText(header).getBytes());
        java.io.ByteArrayInputStream bodyin = new java.io.ByteArrayInputStream(chaudhuri.util.DOMUtil.getContentText(body).getBytes());
        return new java.io.SequenceInputStream(headerin, bodyin);
    }
    
}
