java.lang.Object
net.luis.utils.io.data.OutputProvider
- All Implemented Interfaces:
- AutoCloseable
Output provider for writing data to a file or stream.
This class provides several constructors for different types of output sources.
 
This class provides several constructors for different types of output sources.
     Primary usage of this class is to provide an output stream for different output sources.
     This can be useful for other writers or formatters to keep their constructors clean and simple.
 
AutoCloseable, so it can be used in try-with-resources statements.- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionOutputProvider(@NotNull File file) Constructs a new output provider for the given file.OutputProvider(@NotNull OutputStream stream) Constructs a new output provider for the given output stream.OutputProvider(@NotNull String file) Constructs a new output provider for the given file.OutputProvider(@NotNull String path, @NotNull String fileName) Constructs a new output provider for the given path and file name.
 The path and file name are concatenated to a file.OutputProvider(@NotNull Path path) Constructs a new output provider for the given path.
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()@NotNull OutputStreamReturns the internal output stream for writing data.
 The output stream should not be used directly, it is intended to be passed to other writers or formatters.
- 
Field Details- 
streamThe output stream for writing data.
 
- 
- 
Constructor Details- 
OutputProviderConstructs a new output provider for the given file.- Parameters:
- file- The file to write data to
- Throws:
- NullPointerException- If the file is null
- UncheckedIOException- If the file is not found
 
- 
OutputProviderConstructs a new output provider for the given path and file name.
 The path and file name are concatenated to a file.- Parameters:
- path- The path to the file
- fileName- The name of the file
- Throws:
- NullPointerException- If the path or file name is null
- UncheckedIOException- If the file is not found
 
- 
OutputProviderConstructs a new output provider for the given path.- Parameters:
- path- The path to the file
- Throws:
- NullPointerException- If the path is null
- UncheckedIOException- If the file is not found
 
- 
OutputProviderConstructs a new output provider for the given file.- Parameters:
- file- The file to write data to
- Throws:
- NullPointerException- If the file is null
- UncheckedIOException- If the file is not found
 
- 
OutputProviderConstructs a new output provider for the given output stream.- Parameters:
- stream- The output stream to write data to
- Throws:
- NullPointerException- If the stream is null
 
 
- 
- 
Method Details- 
getStreamReturns the internal output stream for writing data.
 The output stream should not be used directly, it is intended to be passed to other writers or formatters.- Returns:
- The output stream
 
- 
close- Specified by:
- closein interface- AutoCloseable
- Throws:
- IOException
 
 
-