Class Filename
java.lang.Object
org.javagi.base.Filename
A character string in the filesystem encoding.
GLib I/O-related functions use this for compatibility with non-utf8 encoded
filesystems. To display a Filename on-screen, convert it to a Java String
with toString() or toString(Charset).
For more information, consult the GLib documentation on character set conversions.
Most Java methods generated by Java-GI that take Filename arguments are overloaded for convenience with a method that accepts a String argument instead of a Filename.
-
Constructor Summary
ConstructorsConstructorDescriptionFilename(MemorySegment data, long size, TransferOwnership transfer) Create a Filename object from a filename in native memory.Filename(MemorySegment data, TransferOwnership transfer) Create a Filename object from a null-terminated filename in native memory.Create a Filename object from a Java String. -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable Filename @Nullable []convertArray(@Nullable String @Nullable [] strings) Convert an array of Strings to an array of Filenames.static @Nullable String @Nullable []convertArray(@Nullable Filename @Nullable [] filenames) Convert an array of Filenames to an array of Strings.booleaninthashCode()toMemorySegment(SegmentAllocator alloc) Write the filename to native memory.toString()Convert the filename to a Java String.Convert the filename to a Java String, using the provided Charset.
-
Constructor Details
-
Filename
Create a Filename object from a null-terminated filename in native memory.- Parameters:
data- the null-terminated filename in native memorytransfer- to free the native memory when ownership is transferred
-
Filename
Create a Filename object from a filename in native memory.- Parameters:
data- the filename in native memorysize- the size of the filenametransfer- to free the native memory when ownership is transferred
-
Filename
Create a Filename object from a Java String. The string is converted to the native filesystem encoding withg_filename_from_utf8().- Parameters:
string- the filename- Throws:
IllegalArgumentException- when the string cannot be converted to the encoding of the filesystem. This can happen ifstringcontains Japanese characters when the filesystem encoding is set to ISO-8859-1, for example.
-
-
Method Details
-
toMemorySegment
Write the filename to native memory.- Parameters:
alloc- used to allocate the filename- Returns:
- the newly allocated memory segment with the filename
-
toString
Convert the filename to a Java String. The string is converted withg_filename_to_utf8().- Overrides:
toStringin classObject- Returns:
- the filename
- Throws:
IllegalArgumentException- when the filename cannot be converted to utf8.
-
toString
Convert the filename to a Java String, using the provided Charset. The string is converted withString(byte[], Charset).- Parameters:
charset- the charset to decode the filename to a String- Returns:
- the filename
-
equals
-
hashCode
-
convertArray
-
convertArray
-