@@ -46,10 +46,11 @@ import kotlin.use
46
46
*/
47
47
public object JVMFileSystemProvider {
48
48
/* *
49
- * Provides functionality for serializing and deserializing file paths and handling metadata related to file paths.
50
- * Implements the `FileSystemProvider.Serialization` interface for `Path` type .
49
+ * Provides operations for path serialization, structure navigation, and content reading using [Path] objects
50
+ * in a read-only manner without modifying the filesystem .
51
51
*/
52
- public object Serialization : FileSystemProvider.Serialization<Path> {
52
+ public object ReadOnly : FileSystemProvider.ReadOnly<Path> {
53
+
53
54
/* *
54
55
* Converts the given [path] to its absolute path representation as a string.
55
56
* The path is normalized before being converted.
@@ -119,15 +120,7 @@ public object JVMFileSystemProvider {
119
120
}
120
121
return adjustedPath
121
122
}
122
- }
123
123
124
- /* *
125
- * Object implementing file system operations and serialization for file paths.
126
- * Provides functionality for retrieving metadata, listing directory contents,
127
- * determining parent paths, checking the existence of paths, and computing relative paths.
128
- * Delegates serialization-related functionality to the `Serialization` interface.
129
- */
130
- public object Select : FileSystemProvider.Select<Path>, FileSystemProvider.Serialization<Path> by Serialization {
131
124
/* *
132
125
* Retrieves metadata for a given file or directory path.
133
126
*
@@ -195,13 +188,7 @@ public object JVMFileSystemProvider {
195
188
* @return `true` if the file or directory exists, `false` otherwise.
196
189
*/
197
190
override suspend fun exists (path : Path ): Boolean = path.exists()
198
- }
199
191
200
- /* *
201
- * Provides utility methods for reading file data and retrieving file-related metadata.
202
- * Implements the `FileSystemProvider.Read` and delegates file serialization operations to the `Serialization` interface.
203
- */
204
- public object Read : FileSystemProvider.Read<Path>, FileSystemProvider.Serialization<Path> by Serialization {
205
192
/* *
206
193
* Reads the contents of the file located at the specified path.
207
194
*
@@ -248,123 +235,10 @@ public object JVMFileSystemProvider {
248
235
}
249
236
250
237
/* *
251
- * A read-only object implementing file system provider interfaces for handling file
252
- * serialization, selection, and reading functionalities.
253
- *
254
- * This object combines the functionalities of `FileSystemProvider.ReadOnly`,
255
- * `FileSystemProvider.Select`, and `FileSystemProvider.Read` using delegation.
256
- * It provides operations for path serialization, structure navigation, and
257
- * content reading in a read-only manner.
258
- */
259
- public object ReadOnly :
260
- FileSystemProvider .ReadOnly <Path >,
261
- FileSystemProvider .Select <Path > by Select ,
262
- FileSystemProvider .Read <Path > by Read {
263
-
264
- /* *
265
- * Converts the given Path to its absolute path string representation.
266
- *
267
- * @param path the path to be converted to an absolute path string
268
- * @return the absolute path string representation of the given path
269
- */
270
- override fun toAbsolutePathString (path : Path ): String = Serialization .toAbsolutePathString(path)
271
-
272
- /* *
273
- * Converts an absolute string representation of a file path into a normalized Path object.
274
- *
275
- * @param path The absolute string representation of the file path to convert.
276
- * @return A normalized Path object corresponding to the given absolute string.
277
- */
278
- override fun fromAbsoluteString (path : String ): Path = Serialization .fromAbsoluteString(path)
279
-
280
- /* *
281
- * Resolves a given relative path string against a base path and returns the normalized path.
282
- *
283
- * @param base The base path to resolve the relative string against.
284
- * @param path The relative path string to be resolved.
285
- * @return The normalized absolute path obtained by resolving the relative path string against the base path.
286
- */
287
- override fun fromRelativeString (base : Path , path : String ): Path = Serialization .fromRelativeString(base, path)
288
-
289
- /* *
290
- * Retrieves the name of the given path.
291
- *
292
- * @param path the Path object from which the name will be extracted.
293
- * @return the name of the provided path as a String.
294
- */
295
- override fun name (path : Path ): String = Serialization .name(path)
296
-
297
- /* *
298
- * Retrieves the file extension from the specified path using the serialization logic.
299
- *
300
- * @param path The path from which to extract the file extension.
301
- * @return The file extension as a string.
302
- */
303
- override fun extension (path : Path ): String = Serialization .extension(path)
304
- }
305
-
306
- /* *
307
- * Provides a combined object interface for performing both read and write file system operations.
308
- *
309
- * `ReadWrite` implements the `FileSystemProvider.ReadWrite` interface, extending both
310
- * read-only and write capabilities. By delegating to `ReadOnly` and `Write` objects, it provides
311
- * comprehensive file system operations including reading, writing, serialization, and path manipulation.
312
- */
313
- public object ReadWrite :
314
- FileSystemProvider .ReadWrite <Path >,
315
- FileSystemProvider .ReadOnly <Path > by ReadOnly ,
316
- FileSystemProvider .Write <Path > by Write {
317
-
318
- /* *
319
- * Converts the specified [path] to its absolute path represented as a string.
320
- *
321
- * @param path the path to be converted into an absolute path string
322
- * @return the absolute path as a string
323
- */
324
- override fun toAbsolutePathString (path : Path ): String = Serialization .toAbsolutePathString(path)
325
-
326
- /* *
327
- * Converts an absolute string path into a normalized Path object suitable for the current file system.
328
- *
329
- * @param path The absolute string path to be converted.
330
- * @return A Path object representing the input absolute string, normalized for the current file system.
331
- */
332
- override fun fromAbsoluteString (path : String ): Path = Serialization .fromAbsoluteString(path)
333
-
334
- /* *
335
- * Resolves a relative path string against a given base path and normalizes the resulting path.
336
- *
337
- * @param base The base path against which the relative path string will be resolved.
338
- * @param path The relative path string to be resolved.
339
- * @return The resolved and normalized path as a `Path` object.
340
- */
341
- override fun fromRelativeString (base : Path , path : String ): Path = Serialization .fromRelativeString(base, path)
342
-
343
- /* *
344
- * Retrieves the name of the file or directory represented by the specified path.
345
- *
346
- * @param path the path from which the name should be extracted
347
- * @return the name of the file or directory as a string
348
- */
349
- override fun name (path : Path ): String = Serialization .name(path)
350
-
351
- /* *
352
- * Gets the extension of the file represented by the given path.
353
- *
354
- * @param path The path of the file whose extension is to be determined.
355
- * @return The file extension as a string.
356
- */
357
- override fun extension (path : Path ): String = Serialization .extension(path)
358
- }
359
-
360
- /* *
361
- * Singleton object that provides implementations for creating, moving, writing, and deleting files or directories,
362
- * while adhering to a serialization context. It also ensures compatibility with specific operating system constraints
363
- * such as Windows reserved names.
364
- * Implements the `FileSystemProvider.Write` interface with `Path` as the path type and delegates serialization functionalities
365
- * to a `Serialization` implementation.
238
+ * This is the most comprehensive interface, offering complete filesystem operations using [Path] objects
239
+ * including reading, writing, and path manipulation.
366
240
*/
367
- public object Write : FileSystemProvider.Write <Path>, FileSystemProvider.Serialization <Path> by Serialization {
241
+ public object ReadWrite : FileSystemProvider.ReadWrite <Path>, FileSystemProvider.ReadOnly <Path> by ReadOnly {
368
242
369
243
/* *
370
244
* Contains a set of reserved file names in Windows operating systems.
0 commit comments