01: /*
02: ** Java native interface to the Windows Registry API.
03: ** Copyright (c) 1997 by Timothy Gerard Endres
04: **
05: ** This program is free software.
06: **
07: ** You may redistribute it and/or modify it under the terms of the GNU
08: ** General Public License as published by the Free Software Foundation.
09: ** 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;
26:
27: /**
28: * The RegBinaryValue class represents a binary value in the
29: * registry (REG_BINARY).
30: *
31: * @see com.ice.jni.registry.Registry
32: * @see com.ice.jni.registry.RegistryKey
33: */
34:
35: public class RegBinaryValue extends RegistryValue {
36: byte[] data;
37: int dataLen;
38:
39: public RegBinaryValue(RegistryKey key, String name) {
40: super (key, name, RegistryValue.REG_BINARY);
41: this .data = null;
42: this .dataLen = 0;
43: }
44:
45: public RegBinaryValue(RegistryKey key, String name, int type) {
46: super (key, name, type);
47: this .data = null;
48: this .dataLen = 0;
49: }
50:
51: public RegBinaryValue(RegistryKey key, String name, byte[] data) {
52: super (key, name, RegistryValue.REG_BINARY);
53: this .setData(data);
54: }
55:
56: public byte[] getData() {
57: return this .data;
58: }
59:
60: public int getLength() {
61: return this .dataLen;
62: }
63:
64: public void setData(byte[] data) {
65: this .data = data;
66: this .dataLen = data.length;
67: }
68:
69: public byte[] getByteData() {
70: return this .data;
71: }
72:
73: public int getByteLength() {
74: return this .dataLen;
75: }
76:
77: public void setByteData(byte[] data) {
78: this .data = data;
79: this .dataLen = data.length;
80: }
81:
82: public void export(PrintWriter out) {
83: out.println("\"" + this .getName() + "\"=hex:\\");
84: RegistryValue.exportHexData(out, this.data);
85: }
86:
87: }
|