View Javadoc

1   /***
2    *  Copyright 2003-2010 Terracotta, Inc.
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  
17  package net.sf.ehcache;
18  
19  import java.io.Serializable;
20  
21  /***
22   * A bean used to wrap byte[] values to be placed in an Element so as to preserve MIME type information.
23   * <p/>
24   * This class provides the means to bypass Java's serialization mechanism to as to store anything that can be turned
25   * into bytes. It opens the way to non Java uses of ehcache.
26   *
27   * @author Greg Luck
28   * @version $Id: MimeTypeByteArray.html 13146 2011-08-01 17:12:39Z oletizi $
29   */
30  public class MimeTypeByteArray implements Serializable {
31  
32      private String mimeType;
33      private byte[] value;
34  
35      /***
36       * Empty constructor, as required for JavaBeans
37       */
38      public MimeTypeByteArray() {
39          //
40      }
41  
42      /***
43       * Full constructor
44       *
45       * @param mimeType any String that provides information as to the type of the value
46       * @param value    an arbitrary binary value.
47       */
48      public MimeTypeByteArray(String mimeType, byte[] value) {
49          this.mimeType = mimeType;
50          this.value = value;
51      }
52  
53      /***
54       * @return a String that provides information as to the type of the value
55       */
56      public String getMimeType() {
57          return mimeType;
58      }
59  
60      /***
61       *
62       * @param mimeType any String that provides information as to the type of the value
63       */
64      public void setMimeType(String mimeType) {
65          this.mimeType = mimeType;
66      }
67  
68      /***
69       * @return the value, which can be any arbitrary binary value.
70       * @see #getMimeType()
71       */
72      public byte[] getValue() {
73          return value;
74      }
75  
76      /***
77       * @param value an arbitrary binary value.
78       */
79      public void setValue(byte[] value) {
80          this.value = value;
81      }
82  
83  }