KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > swt > internal > ole > win32 > IStorage


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.swt.internal.ole.win32;
12
13 public class IStorage extends IUnknown
14 {
15 public IStorage(int /*long*/ address) {
16     super(address);
17 }
18 public int Commit(int grfCommitFlag) {
19     return COM.VtblCall(9, address, grfCommitFlag);
20 }
21 public int CopyTo(
22     int ciidExclude, //Number of elements in rgiidExclude
23
GUID rgiidExclude, //Array of interface identifiers (IIDs)
24
String JavaDoc[] snbExclude, //Points to a block of stream names in the storage object
25
int /*long*/ pstgDest //Points to destination storage object
26
){
27     // we only support snbExclude = null
28
if (snbExclude != null) {
29         return COM.E_INVALIDARG;
30     }
31     return COM.VtblCall(7, address, ciidExclude, rgiidExclude, 0, pstgDest);
32 }
33 public int CreateStorage(
34     String JavaDoc pwcsName, //Pointer to the name of the new storage object
35
int grfMode, //Access mode for the new storage object
36
int reserved1, //Reserved; must be zero
37
int reserved2, //Reserved; must be zero
38
int /*long*/[] ppStg //Pointer to new storage object
39
){
40     
41     // create a null terminated array of char
42
char[] buffer = null;
43     if (pwcsName != null) {
44         buffer = (pwcsName+"\0").toCharArray();
45     }
46     
47     return COM.VtblCall(5, address, buffer, grfMode, reserved1, reserved2, ppStg);
48 }
49 public int CreateStream(
50     String JavaDoc pwcsName, //Pointer to the name of the new stream
51
int grfMode, //Access mode for the new stream
52
int reserved1, //Reserved; must be zero
53
int reserved2, //Reserved; must be zero
54
int /*long*/[] ppStm //Pointer to new stream object
55
){
56   
57     // create a null terminated array of char
58
char[] buffer = null;
59     if (pwcsName != null) {
60         buffer = (pwcsName+"\0").toCharArray();
61     }
62
63     return COM.VtblCall(3, address, buffer, grfMode, reserved1, reserved2, ppStm);
64 }
65 public int DestroyElement(String JavaDoc pwcsName) {
66
67     // create a null terminated array of char
68
char[] buffer = null;
69     if (pwcsName != null) {
70         buffer = (pwcsName+"\0").toCharArray();
71     }
72     return COM.VtblCall(12, address, buffer);
73 }
74 public int EnumElements(
75     int reserved1, //Reserved; must be zero
76
int /*long*/ reserved2, //Reserved; must be NULL
77
int reserved3, //Reserved; must be zero
78
int /*long*/[] ppenum //Pointer to output variable that
79
// receives the IEnumSTATSTG interface
80
){
81     return COM.VtblCall(11, address, reserved1, reserved2, reserved3, ppenum);
82 }
83 public int OpenStorage(
84     String JavaDoc pwcsName, //Pointer to the name of the
85
// storage object to open
86
int /*long*/ pstgPriority, //Must be NULL.
87
int grfMode, //Access mode for the new storage object
88
String JavaDoc snbExclude[], //Must be NULL.
89
int reserved, //Reserved; must be zero
90
int /*long*/[] ppStg //Pointer to opened storage object
91
){
92
93     // create a null terminated array of char
94
char[] buffer = null;
95     if (pwcsName != null) {
96         buffer = (pwcsName+"\0").toCharArray();
97     }
98
99     // we only support the case where snbExclude = null
100
if (snbExclude != null) {
101         return COM.E_INVALIDARG;
102     }
103     return COM.VtblCall(6, address, buffer, pstgPriority, grfMode, 0, reserved, ppStg);
104 }
105 public int OpenStream(
106     String JavaDoc pwcsName, //Pointer to name of stream to open
107
int /*long*/ reserved1, //Reserved; must be NULL
108
int grfMode, //Access mode for the new stream
109
int reserved2, //Reserved; must be zero
110
int /*long*/[] ppStm //Pointer to output variable
111
// that receives the IStream interface pointer
112
) {
113   
114     // create a null terminated array of char
115
char[] buffer = null;
116     if (pwcsName != null) {
117         buffer = (pwcsName+"\0").toCharArray();
118     }
119
120     return COM.VtblCall(4, address, buffer, reserved1, grfMode, reserved2, ppStm);
121 }
122 public int RenameElement(
123     String JavaDoc pwcsOldName, //Pointer to the name of the
124
// element to be changed
125
String JavaDoc pwcsNewName //Pointer to the new name for
126
// the specified element
127
){
128
129     // create a null terminated array of char
130
char[] buffer1 = null;
131     if (pwcsOldName != null) {
132         buffer1 = (pwcsOldName+"\0").toCharArray();
133     }
134     // create a null terminated array of char
135
char[] buffer2 = null;
136     if (pwcsNewName != null) {
137         buffer2 = (pwcsNewName+"\0").toCharArray();
138     }
139     return COM.VtblCall(13, address, buffer1, buffer2);
140 }
141 public int Revert() {
142     return COM.VtblCall(10, address);
143 }
144 public int SetClass(
145     GUID clsid //CLSID to be assigned to the storage object
146
){
147     return COM.VtblCall(15, address, clsid);
148 }
149 }
150
Popular Tags