Class File
- All Implemented Interfaces:
Proxy
Buffer.
A GtkSourceFile object is the on-disk representation of a Buffer.
With a GtkSourceFile, you can create and configure a FileLoader
and FileSaver which take by default the values of the
GtkSourceFile properties (except for the file loader which auto-detect some
properties). On a successful load or save operation, the GtkSourceFile
properties are updated. If an operation fails, the GtkSourceFile properties
have still the previous valid values.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFile.Builder<B extends File.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionFile()Creates a new File.File(MemorySegment address) Create a File proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected FileasParent()Returns this instance as if it were its parent type.static File.Builder<? extends File.Builder> builder()AFile.Builderobject constructs aFilewith the specified properties.voidChecks synchronously the file on disk, to know whether the file is externally modified, or has been deleted, and whether the file is read-only.The encoding is initiallynull.static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the File classbooleanReturns whether the file has been deleted.booleanReturns whether the file is externally modified.booleanisLocal()Returns whether the file is local.booleanReturns whether the file is read-only.voidsetLocation(@Nullable File location) Sets the location.voidsetMountOperationFactory(@Nullable MountOperationFactory callback) Sets aMountOperationFactoryfunction that will be called when aMountOperationmust be created.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
File
Create a File proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
File
public File()Creates a new File.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
checkFileOnDisk
public void checkFileOnDisk()Checks synchronously the file on disk, to know whether the file is externally modified, or has been deleted, and whether the file is read-only.GtkSourceFiledoesn't create aFileMonitorto track those properties, so this function needs to be called instead. Creating lots ofFileMonitor's would take lots of resources.Since this function is synchronous, it is advised to call it only on local files. See
isLocal(). -
getCompressionType
-
getEncoding
The encoding is initiallynull. After a successful file loading or saving operation, the encoding is non-null.- Returns:
- the character encoding.
-
getLocation
-
getNewlineType
-
isDeleted
public boolean isDeleted()Returns whether the file has been deleted. If theFile:locationisnull, returnsfalse.To have an up-to-date value, you must first call
checkFileOnDisk().- Returns:
- whether the file has been deleted.
-
isExternallyModified
public boolean isExternallyModified()Returns whether the file is externally modified. If theFile:locationisnull, returnsfalse.To have an up-to-date value, you must first call
checkFileOnDisk().- Returns:
- whether the file is externally modified.
-
isLocal
public boolean isLocal()Returns whether the file is local. If theFile:locationisnull, returnsfalse.- Returns:
- whether the file is local.
-
isReadonly
public boolean isReadonly()Returns whether the file is read-only. If theFile:locationisnull, returnsfalse.To have an up-to-date value, you must first call
checkFileOnDisk().- Returns:
- whether the file is read-only.
-
setLocation
Sets the location.- Parameters:
location- the newGFile, ornull.
-
setMountOperationFactory
Sets aMountOperationFactoryfunction that will be called when aMountOperationmust be created.This is useful for creating a
MountOperationwith the parentWindow.If a mount operation factory isn't set,
MountOperation()will be called.- Parameters:
callback- aGtkSourceMountOperationFactoryto call when aGMountOperationis needed.
-
builder
AFile.Builderobject constructs aFilewith the specified properties. Use the variousset...()methods to set properties, and finish construction withFile.Builder.build().- Returns:
- the builder object
-