Package org.apache.james.mime4j.storage

Examples of org.apache.james.mime4j.storage.Storage


     */
    private static BodyPart createImagePart(StorageBodyFactory bodyFactory,
            BufferedImage image) throws IOException {
        // Create a binary message body from the image
        StorageProvider storageProvider = bodyFactory.getStorageProvider();
        Storage storage = storeImage(storageProvider, image, "png");
        BinaryBody body = bodyFactory.binaryBody(storage);

        // Create a body part with the correct MIME-type and transfer encoding
        BodyPart bodyPart = new BodyPart();
        bodyPart.setBody(body, "image/png");
View Full Code Here


     */
    private static BodyPart createImagePart(BodyFactory bodyFactory,
            BufferedImage image) throws IOException {
        // Create a binary message body from the image
        StorageProvider storageProvider = bodyFactory.getStorageProvider();
        Storage storage = storeImage(storageProvider, image, "png");
        BinaryBody body = bodyFactory.binaryBody(storage);

        // Create a body part with the correct MIME-type and transfer encoding
        BodyPart bodyPart = new BodyPart();
        bodyPart.setBody(body, "image/png");
View Full Code Here

import org.apache.james.mime4j.util.CharsetUtil;

public class SingleBodyCopyTest extends TestCase {

    public void testCopyStorageBinaryBody() throws Exception {
        Storage storage = new MemoryStorageProvider()
                .store(new ByteArrayInputStream("test".getBytes()));
        MultiReferenceStorage multiReferenceStorage = new MultiReferenceStorage(
                storage);
        SingleBody body = new StorageBinaryBody(multiReferenceStorage);
        copyTest(body);
View Full Code Here

        SingleBody body = new StorageBinaryBody(multiReferenceStorage);
        copyTest(body);
    }

    public void testCopyStorageTextBody() throws Exception {
        Storage storage = new MemoryStorageProvider()
                .store(new ByteArrayInputStream("test".getBytes()));
        MultiReferenceStorage multiReferenceStorage = new MultiReferenceStorage(
                storage);
        SingleBody body = new StorageTextBody(multiReferenceStorage,
                CharsetUtil.US_ASCII);
View Full Code Here

        SingleBody body = new StringTextBody("test", CharsetUtil.US_ASCII);
        copyTest(body);
    }

    public void testDisposeStorageBinaryBody() throws Exception {
        Storage storage = new MemoryStorageProvider()
                .store(new ByteArrayInputStream("test".getBytes()));
        MultiReferenceStorage multiReferenceStorage = new MultiReferenceStorage(
                storage);
        SingleBody body = new StorageBinaryBody(multiReferenceStorage);
        disposeTest(body, storage);
View Full Code Here

        SingleBody body = new StorageBinaryBody(multiReferenceStorage);
        disposeTest(body, storage);
    }

    public void testDisposeStorageTextBody() throws Exception {
        Storage storage = new MemoryStorageProvider()
                .store(new ByteArrayInputStream("test".getBytes()));
        MultiReferenceStorage multiReferenceStorage = new MultiReferenceStorage(
                storage);
        SingleBody body = new StorageTextBody(multiReferenceStorage,
                CharsetUtil.US_ASCII);
View Full Code Here

     */
    public BinaryBody binaryBody(InputStream is) throws IOException {
        if (is == null)
            throw new IllegalArgumentException();

        Storage storage = storageProvider.store(is);
        return new StorageBinaryBody(new MultiReferenceStorage(storage));
    }
View Full Code Here

     */
    public TextBody textBody(InputStream is) throws IOException {
        if (is == null)
            throw new IllegalArgumentException();

        Storage storage = storageProvider.store(is);
        return new StorageTextBody(new MultiReferenceStorage(storage),
                CharsetUtil.DEFAULT_CHARSET);
    }
View Full Code Here

        if (is == null)
            throw new IllegalArgumentException();
        if (mimeCharset == null)
            throw new IllegalArgumentException();

        Storage storage = storageProvider.store(is);
        Charset charset = toJavaCharset(mimeCharset, false);
        return new StorageTextBody(new MultiReferenceStorage(storage), charset);
    }
View Full Code Here

TOP

Related Classes of org.apache.james.mime4j.storage.Storage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.