Examples of InputStreamSource


Examples of org.htmlparser.lexer.InputStreamSource

     */
    public void testInputStreamSourceReady () throws IOException
    {
        Source source;

        source = new InputStreamSource (new Stream (new ByteArrayInputStream (new byte[] { (byte)0x42, (byte)0x62 })), null);
        assertTrue ("ready?", !source.ready ());
        assertTrue ("erroneous character", 'B' == source.read ());
        assertTrue ("not ready", source.ready ());
        assertTrue ("erroneous character", 'b' == source.read ());
        assertTrue ("ready?", !source.ready ());
View Full Code Here

Examples of org.htmlparser.lexer.InputStreamSource

            connection1 = url.openConnection ();
            connection1.connect ();
            in = new InputStreamReader (new BufferedInputStream (connection1.getInputStream ()), "UTF-8");
            connection2 = url.openConnection ();
            connection2.connect ();
            source = new InputStreamSource (new Stream (connection2.getInputStream ()), "UTF-8");
            index = 0;
            while (-1 != (c1 = in.read ()))
            {
                c2 = source.read ();
                if (c1 != c2)
View Full Code Here

Examples of org.springframework.core.io.InputStreamSource

        assertNotNull("Invalid accept header", resultAccept);
    }

    @Override
    public void testWriteToTransportResponseAttachment() throws Exception {
        InputStreamSource inputStreamSource = new ByteArrayResource("contents".getBytes("UTF-8"));
        soapMessage.addAttachment("contentId", inputStreamSource, "text/plain");
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        MockTransportOutputStream tos = new MockTransportOutputStream(bos);
        soapMessage.writeTo(tos);
        String contentType = tos.getHeaders().get("Content-Type");
View Full Code Here

Examples of org.springframework.core.io.InputStreamSource

        assertNotNull("Invalid accept header", resultAccept);
    }

    @Override
    public void testWriteToTransportResponseAttachment() throws Exception {
        InputStreamSource inputStreamSource = new ByteArrayResource("contents".getBytes("UTF-8"));
        soapMessage.addAttachment("contentId", inputStreamSource, "text/plain");
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        MockTransportOutputStream tos = new MockTransportOutputStream(bos);
        soapMessage.writeTo(tos);
        String contentType = tos.getHeaders().get("Content-Type");
View Full Code Here

Examples of org.springframework.core.io.InputStreamSource

        expect(soapRequest.getSoapBody()).andReturn(soapBody).once();
        expect(soapBody.getPayloadResult()).andReturn(new StringResult()).once();
       
        expect(soapRequest.addAttachment(eq(attachment.getContentId()), (InputStreamSource)anyObject(), eq(attachment.getContentType()))).andAnswer(new IAnswer<Attachment>() {
            public Attachment answer() throws Throwable {
                InputStreamSource contentStream = (InputStreamSource)EasyMock.getCurrentArguments()[1];
                BufferedReader reader = new BufferedReader(new InputStreamReader(contentStream.getInputStream()));
               
                Assert.assertEquals(reader.readLine(), "This is a SOAP attachment");
                Assert.assertEquals(reader.readLine(), "with multi-line");
               
                reader.close();
View Full Code Here

Examples of org.springframework.core.io.InputStreamSource

    private Schema createSchemaFromFile(String fileName) {
        return createSchemaFromFile(fileName, fileName);
    }

    private Schema createSchemaFromFile(String name, final String fileName) {
        return SchemaImpl.create(name, null, true, fileName + " desc", new InputStreamSource() {
            public InputStream getInputStream() throws IOException {
                return new FileInputStream(new File(srcdir, fileName));
            }
        });
    }
View Full Code Here

Examples of org.springframework.core.io.InputStreamSource

    }

    @Test
    public void getOriginalInputStream_exception() {
        // 情况1. parse时调用
        schema = new SchemaBaseImpl(new InputStreamSource() {
            public InputStream getInputStream() throws IOException {
                throw new IOException("hi");
            }

            @Override
            public String toString() {
                return "mysource";
            }
        });

        schema.transform(transformer);

        try {
            schema.getInputStream();
            fail();
        } catch (ConfigurationPointException e) {
            assertThat(e, exception("Failed to read text of schema file: myschema, source=mysource"));
        }

        // 情况2. getInputStream时调用(无transformer)
        schema = new SchemaBaseImpl(new InputStreamSource() {
            public InputStream getInputStream() throws IOException {
                throw new IOException("hi");
            }

            @Override
View Full Code Here

Examples of org.springframework.core.io.InputStreamSource

    private Schema createSchemaFromFile(String fileName) {
        return createSchemaFromFile(fileName, fileName);
    }

    private Schema createSchemaFromFile(String name, final String fileName) {
        return new SchemaImpl(name, null, true, fileName + " desc", new InputStreamSource() {
            public InputStream getInputStream() throws IOException {
                return new FileInputStream(new File(srcdir, fileName));
            }
        });
    }
View Full Code Here

Examples of org.springframework.core.io.InputStreamSource

            String priority, boolean isHtml, String encoding) throws MailException, MessagingException {
        List<Pair<String, InputStreamSource>> att = null;
        if (attachments != null) {
            att = Lists.newArrayList();
            for (File file : attachments) {
                InputStreamSource source = new FileSystemResource(file);
                Pair<String, InputStreamSource> pair = Pair.create(file.getName(), source);
                att.add(pair);
            }
        }
        String[] toArr = null;
View Full Code Here

Examples of org.springframework.core.io.InputStreamSource

            if (matcher.find()) {
                version = matcher.group(1);
            }

            InputStreamSource source = getResource(classpathLocation, uri);

            if (source != null) {
                nameToSchemaMappings.put(schemaName, new SchemaImpl(schemaName, version, true, desc, source));
                uriToNameMappings.put(uri, schemaName);
            }
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.