1   /*
2    * $Id: NamedPayload.java 10489 2008-01-23 17:53:38Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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  
11  package org.mule.transport.ftp.server;
12  
13  public class NamedPayload
14  {
15  
16      public static final String DEFAULT_NAME = "default-file-name";
17      private byte[] payload;
18      private String name;
19  
20      public NamedPayload(byte[] payload)
21      {
22          this(DEFAULT_NAME, payload);
23      }
24  
25      public NamedPayload(String name, byte[] payload)
26      {
27          setName(name);
28          setPayload(payload);
29      }
30  
31      public byte[] getPayload()
32      {
33          return payload;
34      }
35  
36      public void setPayload(byte[] payload)
37      {
38          this.payload = payload;
39      }
40  
41      public String getName()
42      {
43          return name;
44      }
45  
46      public void setName(String name)
47      {
48          this.name = name;
49      }
50  
51      // @Override
52      public String toString()
53      {
54          try
55          {
56              return name + " " + new String(payload);
57          }
58          catch(Exception e)
59          {
60              return name + " " + payload;
61          }
62      }
63  
64  }