View Javadoc

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