View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transport.http.multipart;
8   
9   import java.io.IOException;
10  import java.io.InputStream;
11  import java.io.OutputStream;
12  
13  import javax.activation.DataSource;
14  
15  /**
16   * TODO
17   */
18  public class PartDataSource implements DataSource
19  {
20      private Part part;
21  
22      public PartDataSource(Part part)
23      {
24          this.part = part;
25      }
26  
27      public InputStream getInputStream() throws IOException
28      {
29          return part.getInputStream();
30      }
31  
32      public OutputStream getOutputStream() throws IOException
33      {
34          throw new UnsupportedOperationException("getOutputStream");
35      }
36  
37      public String getContentType()
38      {
39          return part.getContentType();
40      }
41  
42      public String getName()
43      {
44          return part.getName();
45      }
46  
47      public Part getPart()
48      {
49          return part;
50      }
51  }