Examples of InputStreamDataSource


Examples of org.apache.cxf.jaxrs.ext.multipart.InputStreamDataSource

    }
   
    @Test
    public void testWriteDataHandler() throws Exception {
        DataSourceProvider<DataHandler> p = new DataSourceProvider<DataHandler>();
        DataHandler ds = new DataHandler(new InputStreamDataSource(
                             new ByteArrayInputStream("image".getBytes()),
                             "image/png"));
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        p.writeTo(ds, DataHandler.class, DataHandler.class, new Annotation[]{},
                   MediaType.valueOf("image/png"), new MetadataMap<String, Object>(), os);
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.multipart.InputStreamDataSource

    }
   
    @Test
    public void testWriteDataSource() throws Exception {
        DataSourceProvider<DataSource> p = new DataSourceProvider<DataSource>();
        DataSource ds = new InputStreamDataSource(new ByteArrayInputStream("image".getBytes()),
                                                  "image/png");
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        MultivaluedMap<String, Object> outHeaders = new MetadataMap<String, Object>();
       
        p.writeTo(ds, DataSource.class, DataSource.class, new Annotation[]{},
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.multipart.InputStreamDataSource

    }
   
    @Test
    public void testWriteDataSourceWithDiffCT() throws Exception {
        DataSourceProvider<DataSource> p = new DataSourceProvider<DataSource>();
        DataSource ds = new InputStreamDataSource(new ByteArrayInputStream("image".getBytes()),
                                                  "image/png");
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        MultivaluedMap<String, Object> outHeaders = new MetadataMap<String, Object>();
        p.writeTo(ds, DataSource.class, DataSource.class, new Annotation[]{},
                   MediaType.valueOf("image/bar"), outHeaders, os);
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.multipart.InputStreamDataSource

        Class<T> cls = (Class<T>)obj.getClass();
        return getHandlerForObject(obj, cls, genericType, anns, mimeType, id);
    }
   
    private DataHandler createInputStreamDH(InputStream is, String mimeType) {
        return new DataHandler(new InputStreamDataSource(is, mimeType));
    }
View Full Code Here

Examples of org.pentaho.commons.connection.InputStreamDataSource

  public void testInputStreamDataSource() {
    try {
      InputStream inputStream = getClass().getResourceAsStream( "/test/xml/query_without_connection.xaction" ); //$NON-NLS-1$"test/xml/departments.rule.xaction"));
      String name = "mystream"; //$NON-NLS-1$
      InputStreamDataSource is = new InputStreamDataSource( name, inputStream );

      Assert.assertEquals( inputStream, is.getInputStream() );
      Assert.assertEquals( name, is.getName() );
    } catch ( Exception e ) {
      e.printStackTrace();
    }

  }
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.