Package ch.bailu.gtk.glib
Klasse MappedFile
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.type.Record
ch.bailu.gtk.glib.MappedFile
- Alle implementierten Schnittstellen:
PointerInterface
The #GMappedFile represents a file mapping created with
g_mapped_file_new(). It has only private members and should
not be accessed directly.
g_mapped_file_new(). It has only private members and should
not be accessed directly.
-
Feldübersicht
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungMappedFile
(PointerContainer pointer) MappedFile
(Str filename, boolean writable) Maps a file into memory.MappedFile
(String filename, boolean writable) Maps a file into memory. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
free()
Veraltet.getBytes()
Creates a new #GBytes which references the data mapped from @file.static ClassHandler
Returns the contents of a #GMappedFile.static int
long
Returns the length of the contents of a #GMappedFile.static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
static MappedFile
newFromFdMappedFile
(int fd, boolean writable) Maps a file into memory.ref()
Increments the reference count of @file by one.void
unref()
Decrements the reference count of @file by one.Von Klasse geerbte Methoden ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Von Klasse geerbte Methoden ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Konstruktordetails
-
MappedFile
-
MappedFile
Maps a file into memory. On UNIX, this is using the mmap() function.
If @writable is %TRUE, the mapped buffer may be modified, otherwise
it is an error to modify the mapped buffer. Modifications to the buffer
are not visible to other processes mapping the same file, and are not
written back to the file.
Note that modifications of the underlying file might affect the contents
of the #GMappedFile. Therefore, mapping should only be used if the file
will not be modified, or if all modifications of the file are done
atomically (e.g. using g_file_set_contents()).
If @filename is the name of an empty, regular file, the function
will successfully return an empty #GMappedFile. In other cases of
size 0 (e.g. device files such as /dev/null), @error will be set
to the #GFileError value %G_FILE_ERROR_INVAL.- Parameter:
filename
- The path of the file to load, in the GLib filename encodingwritable
- whether the mapping should be writable
-
MappedFile
Maps a file into memory. On UNIX, this is using the mmap() function.
If @writable is %TRUE, the mapped buffer may be modified, otherwise
it is an error to modify the mapped buffer. Modifications to the buffer
are not visible to other processes mapping the same file, and are not
written back to the file.
Note that modifications of the underlying file might affect the contents
of the #GMappedFile. Therefore, mapping should only be used if the file
will not be modified, or if all modifications of the file are done
atomically (e.g. using g_file_set_contents()).
If @filename is the name of an empty, regular file, the function
will successfully return an empty #GMappedFile. In other cases of
size 0 (e.g. device files such as /dev/null), @error will be set
to the #GFileError value %G_FILE_ERROR_INVAL.- Parameter:
filename
- The path of the file to load, in the GLib filename encodingwritable
- whether the mapping should be writable
-
-
Methodendetails
-
getClassHandler
-
newFromFdMappedFile
Maps a file into memory. On UNIX, this is using the mmap() function.
If @writable is %TRUE, the mapped buffer may be modified, otherwise
it is an error to modify the mapped buffer. Modifications to the buffer
are not visible to other processes mapping the same file, and are not
written back to the file.
Note that modifications of the underlying file might affect the contents
of the #GMappedFile. Therefore, mapping should only be used if the file
will not be modified, or if all modifications of the file are done
atomically (e.g. using g_file_set_contents()).- Parameter:
fd
- The file descriptor of the file to loadwritable
- whether the mapping should be writable- Gibt zurück:
- a newly allocated #GMappedFile which must be unref'd with g_mapped_file_unref(), or %NULL if the mapping failed.
- Löst aus:
AllocationError
-
free
Veraltet.This call existed before #GMappedFile had refcounting and is currently
exactly the same as g_mapped_file_unref(). -
getBytes
Creates a new #GBytes which references the data mapped from @file.
The mapped contents of the file must not be modified after creating this
bytes object, because a #GBytes should be immutable.- Gibt zurück:
- A newly allocated #GBytes referencing data from @file
-
getContents
Returns the contents of a #GMappedFile.
Note that the contents may not be zero-terminated,
even if the #GMappedFile is backed by a text file.
If the file is empty then %NULL is returned.- Gibt zurück:
- the contents of @file, or %NULL.
-
getLength
public long getLength()Returns the length of the contents of a #GMappedFile.- Gibt zurück:
- the length of the contents of @file.
-
ref
Increments the reference count of @file by one. It is safe to call
this function from any thread.- Gibt zurück:
- the passed in #GMappedFile.
-
unref
public void unref()Decrements the reference count of @file by one. If the reference count
drops to 0, unmaps the buffer of @file and frees it.
It is safe to call this function from any thread.
Since 2.22 -
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-