View Javadoc

1   /*
2    * Copyright (c) 2001 - 2005 ivata limited.
3    * All rights reserved.
4    * -----------------------------------------------------------------------------
5    * ivata masks may be redistributed under the GNU General Public
6    * License as published by the Free Software Foundation;
7    * version 2 of the License.
8    *
9    * These programs are free software; you can redistribute them and/or
10   * modify them under the terms of the GNU General Public License
11   * as published by the Free Software Foundation; version 2 of the License.
12   *
13   * These programs are distributed in the hope that they will be useful,
14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16   *
17   * See the GNU General Public License in the file LICENSE.txt for more
18   * details.
19   *
20   * If you would like a copy of the GNU General Public License write to
21   *
22   * Free Software Foundation, Inc.
23   * 59 Temple Place - Suite 330
24   * Boston, MA 02111-1307, USA.
25   *
26   *
27   * To arrange commercial support and licensing, contact ivata at
28   *                  http://www.ivata.com/contact.jsp
29   * -----------------------------------------------------------------------------
30   * $Log: SerializedByteArray.java,v $
31   * Revision 1.3  2005/04/09 18:04:17  colinmacleod
32   * Changed copyright text to GPL v2 explicitly.
33   *
34   * Revision 1.2  2005/01/06 22:21:45  colinmacleod
35   * Moved up a version number.
36   * Changed copyright notices to 2005.
37   * Updated the documentation:
38   *   - started working on multiproject:site docu.
39   *   - changed the logo.
40   * Added checkstyle and fixed LOADS of style issues.
41   * Added separate thirdparty subproject.
42   * Added struts (in web), util and webgui (in webtheme) from ivata op.
43   *
44   * Revision 1.4  2004/03/21 21:16:36  colinmacleod
45   * Shortened name to ivata op.
46   *
47   * Revision 1.3  2004/02/10 19:57:25  colinmacleod
48   * Changed email address.
49   *
50   * Revision 1.2  2004/02/01 22:07:32  colinmacleod
51   * Added full names to author tags
52   *
53   * Revision 1.1.1.1  2004/01/27 20:59:46  colinmacleod
54   * Moved ivata op to SourceForge.
55   *
56   * Revision 1.2  2003/10/15 14:13:53  colin
57   * fixing for XDoclet
58   *
59   * Revision 1.4  2003/02/24 19:27:31  colin
60   * restructured file paths
61   *
62   * Revision 1.3  2003/02/04 17:43:52  colin
63   * copyright notice
64   *
65   * Revision 1.2  2002/09/09 12:58:47  peter
66   * changes on SerializedByteArray
67   *
68   * Revision 1.1  2002/08/16 11:38:44  peter
69   * created with rose, does not do anything so far...
70   * -----------------------------------------------------------------------------
71   */
72  package com.ivata.mask.util;
73  import java.io.ByteArrayInputStream;
74  import java.io.InputStream;
75  import java.io.Serializable;
76  /***
77   * <p>
78   * This is a utility class which serializes an array of bytes.
79   * </p>
80   *
81   * @since ivata masks 0.4 (2001-04-20)
82   * @author Peter Illes
83   * @version $Revision: 1.3 $
84   */
85  public class SerializedByteArray implements Serializable {
86      /***
87       * <p>
88       * The array of bytes to store in this instance.
89       * </p>
90       */
91      private byte[] bytes;
92      /***
93       * <p>
94       * Default constructor. Creates an instance holding the values of an array
95       * of bytes.
96       * </p>
97       *
98       * @param byteArray
99       *            byte array to hold the values of
100      */
101     public SerializedByteArray(final byte[] byteArray) {
102         this.bytes = byteArray;
103     }
104     /***
105      * <p>
106      * Get an inputStream containing the array contents.
107      * </p>
108      *
109      * @return <code>InputStream</code> containing the array contents.
110      */
111     public final InputStream getInputStream() {
112         InputStream inputStream = new ByteArrayInputStream(bytes);
113         return inputStream;
114     }
115 }