Package javax.activation

Examples of javax.activation.DataHandler.writeTo()


                                getAttributeValue(new QName(FIXConstants.FIX_MESSAGE_REFERENCE));
                        }
                        if (href != null) {
                            DataHandler binaryDataHandler = msgCtx.getAttachment(href.substring(4));
                            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                            binaryDataHandler.writeTo(outputStream);
                            value = new String(outputStream.toByteArray());
                        }
                    } else {
                        value = trailerNode.getText();
                    }
View Full Code Here


    @Override
    protected byte[] getBytes(Object object) {
        DataHandler handler = (DataHandler) object;
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            handler.writeTo(baos);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return baos.toByteArray();
    }
View Full Code Here

            }
            serviceArchive = new File(tempDirName + File.separator + serviceGroupName);
            FileOutputStream out = null;
            try {
                out = new FileOutputStream(serviceArchive);
                dh.writeTo(out);
                out.close();
            } finally {
                if (out != null) {
                    out.close();
                }
View Full Code Here

            if (f.exists()) {
                f.delete();
            }

            FileOutputStream fos = new FileOutputStream(f);
            dh.writeTo(fos);
        } else {
            System.out
                    .println(">> [ERROR] - ImageDepot was not null, but did not contain binary data");
        }
    }
View Full Code Here

        }
        DataHandler dh = new DataHandler(src.toURL());
        FileOutputStream out = null;
        try {
            out = new FileOutputStream(dst);
            dh.writeTo(out);
            out.flush();
        } finally {
            if (out != null) {
                out.close();
            }
View Full Code Here

        assertNotNull(((Map)result).get("foo"));
        assertTrue(((Map)result).get("foo") instanceof DataHandler);
        DataHandler dh = (DataHandler)((Map)result).get("foo");
        ByteArrayOutputStream baos = new ByteArrayOutputStream(4);
        dh.writeTo(baos);
        assertEquals("moo", baos.toString());

        assertNotNull(((Map)result).get("baz"));
        assertTrue(((Map)result).get("baz") instanceof DataHandler);
        dh = (DataHandler)((Map)result).get("baz");
View Full Code Here

        assertNotNull(((Map)result).get("baz"));
        assertTrue(((Map)result).get("baz") instanceof DataHandler);
        dh = (DataHandler)((Map)result).get("baz");
        baos = new ByteArrayOutputStream(4);
        dh.writeTo(baos);
        assertEquals("maz", baos.toString());

        result = eval.evaluate("message.attachments(fool?)", createMessageWithAttachments());
        assertNotNull(result);
        assertTrue(result instanceof Map);
View Full Code Here

        assertNotNull(((Map)result).get("foo"));
        assertTrue(((Map)result).get("foo") instanceof DataHandler);
        dh = (DataHandler)((Map)result).get("foo");
        baos = new ByteArrayOutputStream(4);
        dh.writeTo(baos);
        assertEquals("moo", baos.toString());

        assertNotNull(((Map)result).get("baz"));
        assertTrue(((Map)result).get("baz") instanceof DataHandler);
        dh = (DataHandler)((Map)result).get("baz");
View Full Code Here

        assertNotNull(((Map)result).get("baz"));
        assertTrue(((Map)result).get("baz") instanceof DataHandler);
        dh = (DataHandler)((Map)result).get("baz");
        baos = new ByteArrayOutputStream(4);
        dh.writeTo(baos);
        assertEquals("maz", baos.toString());       

        try
        {
            eval.evaluate("message.attachments(fool)", createMessageWithAttachments());
View Full Code Here

        assertEquals(2, ((List)result).size());

        assertTrue(((List)result).get(0) instanceof DataHandler);
        DataHandler dh = (DataHandler)((List)result).get(0);
        ByteArrayOutputStream baos = new ByteArrayOutputStream(4);
        dh.writeTo(baos);
        assertEquals("moo", baos.toString());

        assertTrue(((List)result).get(1) instanceof DataHandler);
        dh = (DataHandler)((List)result).get(1);
        baos = new ByteArrayOutputStream(4);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.