KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ice > jni > registry > RegBinaryValue


1 /*
2 ** Java native interface to the Windows Registry API.
3 ** Copyright (c) 1997 by Timothy Gerard Endres
4 **
5 ** This program is free software.
6 **
7 ** You may redistribute it and/or modify it under the terms of the GNU
8 ** General Public License as published by the Free Software Foundation.
9 ** Version 2 of the license should be included with this distribution in
10 ** the file LICENSE, as well as License.html. If the license is not
11 ** included with this distribution, you may find a copy at the FSF web
12 ** site at 'www.gnu.org' or 'www.fsf.org', or you may write to the
13 ** Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139 USA.
14 **
15 ** THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY OF ANY KIND,
16 ** NOT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY. THE AUTHOR
17 ** OF THIS SOFTWARE, ASSUMES _NO_ RESPONSIBILITY FOR ANY
18 ** CONSEQUENCE RESULTING FROM THE USE, MODIFICATION, OR
19 ** REDISTRIBUTION OF THIS SOFTWARE.
20 **
21 */

22
23 package com.ice.jni.registry;
24
25 import java.io.PrintWriter JavaDoc;
26
27
28 /**
29  * The RegBinaryValue class represents a binary value in the
30  * registry (REG_BINARY).
31  *
32  * @see com.ice.jni.registry.Registry
33  * @see com.ice.jni.registry.RegistryKey
34  */

35
36 public class
37 RegBinaryValue extends RegistryValue
38     {
39     byte[] data;
40     int dataLen;
41
42
43     public
44     RegBinaryValue( RegistryKey key, String JavaDoc name )
45         {
46         super( key, name, RegistryValue.REG_BINARY );
47         this.data = null;
48         this.dataLen = 0;
49         }
50
51     public
52     RegBinaryValue( RegistryKey key, String JavaDoc name, int type )
53         {
54         super( key, name, type );
55         this.data = null;
56         this.dataLen = 0;
57         }
58
59     public
60     RegBinaryValue( RegistryKey key, String JavaDoc name, byte[] data )
61         {
62         super( key, name, RegistryValue.REG_BINARY );
63         this.setData( data );
64         }
65
66     public byte[]
67     getData()
68         {
69         return this.data;
70         }
71
72     public int
73     getLength()
74         {
75         return this.dataLen;
76         }
77
78     public void
79     setData( byte[] data )
80         {
81         this.data = data;
82         this.dataLen = data.length;
83         }
84
85     public byte[]
86     getByteData()
87         {
88         return this.data;
89         }
90
91     public int
92     getByteLength()
93         {
94         return this.dataLen;
95         }
96
97     public void
98     setByteData( byte[] data )
99         {
100         this.data = data;
101         this.dataLen = data.length;
102         }
103
104     public void
105     export( PrintWriter JavaDoc out )
106         {
107         out.println( "\"" + this.getName() + "\"=hex:\\" );
108         RegistryValue.exportHexData( out, this.data );
109         }
110
111     }
112
113
114
115
116
Popular Tags