Interface GeneratedFile
- All Superinterfaces:
Immutable
- All Known Implementing Classes:
AbstractGeneratedFile
,AbstractGeneratedTextFile
The contents of a generated file and its
GeneratedFileLifecycle
.-
Method Summary
Modifier and TypeMethodDescriptionReturn 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 Details
-
getLifecycle
GeneratedFileLifecycle getLifecycle()Return the lifecycle governing this file.- Returns:
- Governing lifecycle
-
writeBody
Write the body of this file into specifiedOutputStream
.- Parameters:
output
- stream where to write the output- Throws:
IOException
- when the stream reports an IOExceptionNullPointerException
- ifoutput
isnull
-
of
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 isnull
-
of
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 isnull
-
of
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 isnull
-