public interface FileTreeWriter
extends java.lang.AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this file tree, necessary for virtual
file trees in a single file, like a ZIP file
tree
|
static FileTreeWriter |
directory(java.io.File root)
Creates a new
FileTreeWriter instance for
the given File folder, all files will
be written inside it |
static FileTreeWriter |
directory(java.io.File root,
boolean clear)
Creates a new
FileTreeWriter instance for
the given File folder, all files will
be written inside it |
boolean |
exists(java.lang.String path)
Determines if a file exists in this file
tree
|
default void |
finish()
Finishes writing the file tree without
closing the underlying resource, if any
|
default com.google.gson.stream.JsonWriter |
openJsonWriter(java.lang.String path)
Deprecated.
|
java.io.OutputStream |
openStream(java.lang.String path)
Opens the file at the given path and starts
to write it
|
default java.io.Writer |
openWriter(java.lang.String path)
Opens the file at the given path and starts
to write it using the
Writer class,
which is used for character streams |
void |
write(java.lang.String path,
team.unnamed.creative.base.Writable data)
Opens and writes the given data to the
specified file path
|
static FileTreeWriter |
zip(java.util.zip.ZipOutputStream zipStream)
Creates a new
FileTreeWriter instance for
the given ZipOutputStream, will not
be closed |
static FileTreeWriter |
zip(java.util.zip.ZipOutputStream zipStream,
java.util.function.Function<java.lang.String,java.util.zip.ZipEntry> entryFactory)
Deprecated.
Use
zip(ZipOutputStream, ZipEntryLifecycleHandler) instead |
static FileTreeWriter |
zip(java.util.zip.ZipOutputStream zipStream,
ZipEntryLifecycleHandler entryLifecycleHandler)
Creates a new
FileTreeWriter instance for
the given ZipOutputStream, will not
be closed |
boolean exists(java.lang.String path)
path - The file pathjava.io.OutputStream openStream(java.lang.String path)
path - The file pathOutputStream for the
given filedefault java.io.Writer openWriter(java.lang.String path)
Writer class,
which is used for character streamspath - The file pathWriter for the given file@Deprecated @ApiStatus.ScheduledForRemoval(inVersion="2.0.0") default com.google.gson.stream.JsonWriter openJsonWriter(java.lang.String path)
void write(java.lang.String path,
team.unnamed.creative.base.Writable data)
path - The file pathdata - The file datadefault void finish()
void close()
close in interface java.lang.AutoCloseablestatic FileTreeWriter directory(java.io.File root, boolean clear)
FileTreeWriter instance for
the given File folder, all files will
be written inside it
Will delete all the contents of the root
folder if clear is set to true
root - The root folderclear - True to delete the folder contentsstatic FileTreeWriter directory(java.io.File root)
FileTreeWriter instance for
the given File folder, all files will
be written inside it
Will delete all the contents of the root
folder
root - The root folderstatic FileTreeWriter zip(java.util.zip.ZipOutputStream zipStream, ZipEntryLifecycleHandler entryLifecycleHandler)
FileTreeWriter instance for
the given ZipOutputStream, will not
be closed
Note that the created file tree will never
close the given output stream, but it may be
finished (ZipOutputStream.finish())
zipStream - The underlying zip streamentryLifecycleHandler - The ZIP archive entry lifecycle handler@Deprecated static FileTreeWriter zip(java.util.zip.ZipOutputStream zipStream, java.util.function.Function<java.lang.String,java.util.zip.ZipEntry> entryFactory)
zip(ZipOutputStream, ZipEntryLifecycleHandler) insteadFileTreeWriter instance for
the given ZipOutputStream, will not
be closed
Note that the created file tree will never
close the given output stream, but it may be
finished (ZipOutputStream.finish())
zipStream - The underlying zip streamentryFactory - The ZIP archive entry factorystatic FileTreeWriter zip(java.util.zip.ZipOutputStream zipStream)
FileTreeWriter instance for
the given ZipOutputStream, will not
be closed
Note that the created file tree will never
close the given output stream, but it may be
finished (ZipOutputStream.finish())
zipStream - The underlying zip stream