summaryrefslogtreecommitdiffstats
path: root/kdejava/koala/org/kde/koala/KSaveFile.java
blob: 31a29dd76c234c9f43835055f883e334af2043c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
//Auto-generated by kalyptus. DO NOT EDIT.
package org.kde.koala;

import org.kde.qt.Qt;
import org.kde.qt.QtSupport;
import org.kde.qt.QDataStream;
import org.kde.qt.QFile;
import org.kde.qt.QTextStream;

/**

 The KSaveFile class has been made to write out changes to an existing
 file atomically.
 This means that EITHER:
 a)
   All changes have been written successfully to the file.
 b)
   Some error occurred, no changes have been written whatsoever and the
   old file is still in place.
 		@short    The KSaveFile class has been made to write out changes to an existing  file atomically.

*/
public class KSaveFile implements QtSupport {
	private long _qt;
	private boolean _allocatedInJavaWorld = true;
	protected KSaveFile(Class dummy){}

	/**	
		 Creates a new KSaveFile with the given file name.
			@param filename the path of the file
			@param mode the mode of the file (see chmod(1))
		    		@short    Creates a new KSaveFile with the given file name.
	*/
	public KSaveFile(String filename, int mode) {
		newKSaveFile(filename,mode);
	}
	private native void newKSaveFile(String filename, int mode);
	public KSaveFile(String filename) {
		newKSaveFile(filename);
	}
	private native void newKSaveFile(String filename);
	/**	
		 Returns the status of the file based on errno. (see errno.h)
		 0 means OK.
			 You should check the status after object creation to check
		 whether a file could be created in the first place.
			 You may check the status after closing the file to verify that
		 the file has indeed been written correctly.
				@return the errno status, 0 means ok

		@short    Returns the status of the file based on errno.
	*/
	public native int status();
	/**	
		 The name of the file as passed to the constructor.
				@return The name of the file, or null if opening the
         file has failed

		@short    The name of the file as passed to the constructor.
	*/
	public native String name();
	/**	
		 An integer file descriptor open for writing to the file.
				@return The file descriptor, or a negative number if opening
         the temporary file failed

		@short    An integer file descriptor open for writing to the file.
	*/
	public native int handle();
	/**	
		 A FILE stream open for writing to the file.
				@return FILE* stream open for writing to the file, or 0
         if opening the temporary file failed

		@short    A FILE  stream open for writing to the file.
	*/
	// FILE* fstream(); >>>> NOT CONVERTED
	/**	
		 A QFile open for writing to the file.
				@return A QFile open for writing to the file, or 0 if
         opening the temporary file failed.

		@short    A QFile  open for writing to the file.
	*/
	public native QFile file();
	/**	
		 A QTextStream open for writing to the file.
				@return A QTextStream that is open for writing to the file, or 0
         if opening the temporary file failed

		@short    A QTextStream  open for writing to the file.
	*/
	public native QTextStream textStream();
	/**	
		 A QDataStream open for writing to the file.
				@return A QDataStream that is open for writing to the file, or 0
         if opening the file failed

		@short    A QDataStream  open for writing to the file.
	*/
	public native QDataStream dataStream();
	/**	
		 Aborts the write operation and removes any intermediate files
		 This implies a close.
				@short    Aborts the write operation and removes any intermediate files  This implies a close.
	*/
	public native void abort();
	/**	
		 Closes the file and makes the changes definitive.
		 Returns 'true' is successful, or 'false' if an error has occurred.
		 See status() for details about errors.
				@return true if successful, or false if an error has occurred.

		@short    Closes the file and makes the changes definitive.
	*/
	public native boolean close();
	/**	
		 Static method to create a backup file before saving.
		 You can use this method even if you don't use KSaveFile.
			@param filename the file to backup
			@param backupDir optional directory where to save the backup file in.
		 If empty (the default), the backup will be in the same directory as <code>filename.</code>
			@param backupExtension the extension to append to <code>filename</code>, "~" by default.
				@short    Static method to create a backup file before saving.
	*/
	public static native boolean backupFile(String filename, String backupDir, String backupExtension);
	public static native boolean backupFile(String filename, String backupDir);
	public static native boolean backupFile(String filename);
	/** Deletes the wrapped C++ instance */
	protected native void finalize() throws InternalError;
	/** Delete the wrapped C++ instance ahead of finalize() */
	public native void dispose();
	/** Has the wrapped C++ instance been deleted? */
	public native boolean isDisposed();
}