//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();
}
