Interface GeneratedFile
-
- All Superinterfaces:
Immutable
,MutationBehaviour<Immutable>
- All Known Implementing Classes:
AbstractGeneratedFile
,AbstractGeneratedTextFile
@Beta @NonNullByDefault public interface GeneratedFile extends Immutable
The contents of a generated file and itsGeneratedFileLifecycle
.- Author:
- Robert Varga
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description GeneratedFileLifecycle
getLifecycle()
Return the lifecycle governing this file.static GeneratedFile
of(GeneratedFileLifecycle lifecycle, ByteSource body)
Create a newGeneratedFile
with the specifiedByteSource
body.static GeneratedFile
of(GeneratedFileLifecycle lifecycle, CharSource body)
Create a newGeneratedFile
with the specifiedCharSource
body.static GeneratedFile
of(GeneratedFileLifecycle lifecycle, CharSequence body)
Create a newGeneratedFile
with the specifiedCharSequence
body.void
writeBody(OutputStream output)
Write the body of this file into specifiedOutputStream
.
-
-
-
Method Detail
-
getLifecycle
GeneratedFileLifecycle getLifecycle()
Return the lifecycle governing this file.- Returns:
- Governing lifecycle
-
writeBody
void writeBody(OutputStream output) throws IOException
Write the body of this file into specifiedOutputStream
.- Parameters:
output
- stream where to write the output- Throws:
IOException
- when the stream reports an IOException
-
of
static GeneratedFile of(GeneratedFileLifecycle lifecycle, CharSequence body)
Create a newGeneratedFile
with the specifiedCharSequence
body. The body will be encoded inStandardCharsets.UTF_8
.- Parameters:
lifecycle
- File lifecyclebody
- File body- Returns:
- A GeneratedFile.
- Throws:
NullPointerException
- if any argument is null
-
of
static GeneratedFile of(GeneratedFileLifecycle lifecycle, CharSource body)
Create a newGeneratedFile
with the specifiedCharSource
body. The body will be encoded inStandardCharsets.UTF_8
.- Parameters:
lifecycle
- File lifecyclebody
- File body- Returns:
- A GeneratedFile.
- Throws:
NullPointerException
- if any argument is null
-
of
static GeneratedFile of(GeneratedFileLifecycle lifecycle, ByteSource body)
Create a newGeneratedFile
with the specifiedByteSource
body. The body will be written as is.- Parameters:
lifecycle
- File lifecyclebody
- File body- Returns:
- A GeneratedFile.
- Throws:
NullPointerException
- if any argument is null
-
-