Package org.apache.commons.io.build
Class AbstractOriginSupplier<T,B extends AbstractOriginSupplier<T,B>>
java.lang.Object
org.apache.commons.io.build.AbstractSupplier<T,B>
org.apache.commons.io.build.AbstractOriginSupplier<T,B>
- Type Parameters:
T
- the type of instances to build.B
- the type of builder subclass.
- All Implemented Interfaces:
IOSupplier<T>
- Direct Known Subclasses:
AbstractStreamBuilder
,FileAlterationObserver.Builder
public abstract class AbstractOriginSupplier<T,B extends AbstractOriginSupplier<T,B>>
extends AbstractSupplier<T,B>
Abstracts building an instance of
T
.- Since:
- 2.12.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected AbstractOrigin<?,
?> Checks whether the origin is null.protected AbstractOrigin<?,
?> Gets the origin.protected boolean
Tests whether the origin is null.protected static AbstractOrigin.ByteArrayOrigin
newByteArrayOrigin
(byte[] origin) Constructs a new byte array origin for a byte array.protected static AbstractOrigin.CharSequenceOrigin
newCharSequenceOrigin
(CharSequence origin) Constructs a new CharSequence origin for a CharSequence.protected static AbstractOrigin.FileOrigin
newFileOrigin
(File origin) Constructs a new file origin for a file.protected static AbstractOrigin.FileOrigin
newFileOrigin
(String origin) Constructs a new file origin for a file path.protected static AbstractOrigin.InputStreamOrigin
newInputStreamOrigin
(InputStream origin) Constructs a new input stream origin for a file.protected static AbstractOrigin.OutputStreamOrigin
newOutputStreamOrigin
(OutputStream origin) Constructs a new output stream origin for a file.protected static AbstractOrigin.PathOrigin
newPathOrigin
(String origin) Constructs a new path name origin for a path name.protected static AbstractOrigin.PathOrigin
newPathOrigin
(Path origin) Constructs a new path origin for a file.protected static AbstractOrigin.RandomAccessFileOrigin
Constructs a new RandomAccessFile origin for a RandomAccessFile.protected static AbstractOrigin.IORandomAccessFileOrigin
Constructs a new RandomAccessFile origin for a RandomAccessFile.protected static AbstractOrigin.ReaderOrigin
newReaderOrigin
(Reader origin) Constructs a new reader origin for a reader.protected static AbstractOrigin.URIOrigin
newURIOrigin
(URI origin) Constructs a new reader origin for a URI.protected static AbstractOrigin.WriterOrigin
newWriterOrigin
(Writer origin) Constructs a new writer origin for a file.setByteArray
(byte[] origin) Sets a new origin.setCharSequence
(CharSequence origin) Sets a new origin.Sets a new origin.Sets a new origin.setInputStream
(InputStream origin) Sets a new origin.protected B
setOrigin
(AbstractOrigin<?, ?> origin) Sets a new origin.setOutputStream
(OutputStream origin) Sets a new origin.Sets a new origin.Sets a new origin.setRandomAccessFile
(RandomAccessFile origin) Sets a new origin.Sets a new origin.Sets a new origin.Sets a new origin.Sets a new origin.Methods inherited from class org.apache.commons.io.build.AbstractSupplier
asThis
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.commons.io.function.IOSupplier
asSupplier, get, getUnchecked
-
Constructor Details
-
AbstractOriginSupplier
public AbstractOriginSupplier()
-
-
Method Details
-
newByteArrayOrigin
Constructs a new byte array origin for a byte array.- Parameters:
origin
- the byte array.- Returns:
- a new byte array origin.
-
newCharSequenceOrigin
Constructs a new CharSequence origin for a CharSequence.- Parameters:
origin
- the CharSequence.- Returns:
- a new file origin.
- Since:
- 2.13.0
-
newFileOrigin
Constructs a new file origin for a file.- Parameters:
origin
- the file.- Returns:
- a new file origin.
-
newFileOrigin
Constructs a new file origin for a file path.- Parameters:
origin
- the file path.- Returns:
- a new file origin.
-
newInputStreamOrigin
Constructs a new input stream origin for a file.- Parameters:
origin
- the input stream.- Returns:
- a new input stream origin.
-
newOutputStreamOrigin
Constructs a new output stream origin for a file.- Parameters:
origin
- the output stream.- Returns:
- a new output stream origin.
-
newPathOrigin
Constructs a new path origin for a file.- Parameters:
origin
- the path.- Returns:
- a new path origin.
-
newPathOrigin
Constructs a new path name origin for a path name.- Parameters:
origin
- the path name.- Returns:
- a new path name origin.
-
newRandomAccessFileOrigin
protected static AbstractOrigin.IORandomAccessFileOrigin newRandomAccessFileOrigin(IORandomAccessFile origin) Constructs a new RandomAccessFile origin for a RandomAccessFile.- Parameters:
origin
- the reader.- Returns:
- a new reader origin.
- Since:
- 2.18.0
-
newRandomAccessFileOrigin
protected static AbstractOrigin.RandomAccessFileOrigin newRandomAccessFileOrigin(RandomAccessFile origin) Constructs a new RandomAccessFile origin for a RandomAccessFile.- Parameters:
origin
- the reader.- Returns:
- a new reader origin.
- Since:
- 2.18.0
-
newReaderOrigin
Constructs a new reader origin for a reader.- Parameters:
origin
- the reader.- Returns:
- a new reader origin.
-
newURIOrigin
Constructs a new reader origin for a URI.- Parameters:
origin
- the URI.- Returns:
- a new URI origin.
-
newWriterOrigin
Constructs a new writer origin for a file.- Parameters:
origin
- the writer.- Returns:
- a new writer .
-
checkOrigin
Checks whether the origin is null.- Returns:
- the origin.
- Throws:
IllegalStateException
- if theorigin
isnull
.
-
getOrigin
Gets the origin.- Returns:
- the origin.
-
hasOrigin
Tests whether the origin is null.- Returns:
- whether the origin is null.
-
setByteArray
Sets a new origin.- Parameters:
origin
- the new origin.- Returns:
this
instance.
-
setCharSequence
Sets a new origin.- Parameters:
origin
- the new origin.- Returns:
this
instance.- Since:
- 2.13.0
-
setFile
Sets a new origin.- Parameters:
origin
- the new origin.- Returns:
this
instance.
-
setFile
Sets a new origin.- Parameters:
origin
- the new origin.- Returns:
this
instance.
-
setInputStream
Sets a new origin.- Parameters:
origin
- the new origin.- Returns:
this
instance.
-
setOrigin
Sets a new origin.- Parameters:
origin
- the new origin.- Returns:
this
instance.
-
setOutputStream
Sets a new origin.- Parameters:
origin
- the new origin.- Returns:
this
instance.
-
setPath
Sets a new origin.- Parameters:
origin
- the new origin.- Returns:
this
instance.
-
setPath
Sets a new origin.- Parameters:
origin
- the new origin.- Returns:
this
instance.
-
setRandomAccessFile
Sets a new origin.- Parameters:
origin
- the new origin.- Returns:
this
instance.- Since:
- 2.18.0
-
setRandomAccessFile
Sets a new origin.- Parameters:
origin
- the new origin.- Returns:
this
instance.- Since:
- 2.18.0
-
setReader
Sets a new origin.- Parameters:
origin
- the new origin.- Returns:
this
instance.
-
setURI
Sets a new origin.- Parameters:
origin
- the new origin.- Returns:
this
instance.
-
setWriter
Sets a new origin.- Parameters:
origin
- the new origin.- Returns:
this
instance.
-