Class AbstractOrigin.PathOrigin
java.lang.Object
org.apache.commons.io.build.AbstractSupplier<Path, AbstractOrigin.PathOrigin>
org.apache.commons.io.build.AbstractOrigin<Path, AbstractOrigin.PathOrigin>
org.apache.commons.io.build.AbstractOrigin.PathOrigin
- All Implemented Interfaces:
IOSupplier<Path>
- Enclosing class:
AbstractOrigin<T, B extends AbstractOrigin<T,B>>
public static class AbstractOrigin.PathOrigin
extends AbstractOrigin<Path, AbstractOrigin.PathOrigin>
A
Path origin.
Starting from this origin, you can get a byte array, a file, an input stream, an output stream, a path, a reader, and a writer.
- Since:
- 2.12.0
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractOrigin
AbstractOrigin.AbstractRandomAccessFileOrigin<T,B>, AbstractOrigin.ByteArrayOrigin, AbstractOrigin.ChannelOrigin, AbstractOrigin.CharSequenceOrigin, AbstractOrigin.FileOrigin, AbstractOrigin.InputStreamOrigin, AbstractOrigin.IORandomAccessFileOrigin, AbstractOrigin.OutputStreamOrigin, AbstractOrigin.PathOrigin, AbstractOrigin.RandomAccessFileOrigin, AbstractOrigin.ReaderOrigin, AbstractOrigin.URIOrigin, AbstractOrigin.WriterOrigin -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]getByteArray(long position, int length) Gets a portion of this origin as a byte array, if possible.protected ChannelgetChannel(OpenOption... options) Gets this origin as a Channel, if possible.getFile()Gets this origin as a File, if possible.getPath()Gets this origin as a Path, if possible.Methods inherited from class AbstractOrigin
get, getByteArray, getChannel, getCharSequence, getInputStream, getOutputStream, getRandomAccessFile, getReader, getWriter, size, toStringMethods inherited from class AbstractSupplier
asThisMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface IOSupplier
asSupplier, getUnchecked
-
Constructor Details
-
PathOrigin
Constructs a new instance for the given origin.- Parameters:
origin- The origin, not null.- Throws:
NullPointerException- iforiginisnull.
-
-
Method Details
-
getByteArray
Description copied from class:AbstractOriginGets a portion of this origin as a byte array, if possible.- Overrides:
getByteArrayin classAbstractOrigin<Path, AbstractOrigin.PathOrigin>- Parameters:
position- the initial index of the range to be copied, inclusive.length- How many bytes to copy.- Returns:
- this origin as a byte array, if possible.
- Throws:
IOException- if an I/O error occurs.
-
getChannel
Description copied from class:AbstractOriginGets this origin as a Channel, if possible.- Overrides:
getChannelin classAbstractOrigin<Path, AbstractOrigin.PathOrigin>- Parameters:
options- Options specifying how a file-based origin is opened, ignored otherwise.- Returns:
- A new Channel on the origin.
- Throws:
IOException- If an I/O error occurs.- See Also:
-
getFile
Description copied from class:AbstractOriginGets this origin as a File, if possible.- Overrides:
getFilein classAbstractOrigin<Path, AbstractOrigin.PathOrigin>- Returns:
- this origin as a File, if possible.
-
getPath
Gets this origin as a Path, if possible.No conversion should occur when calling this method.
- Overrides:
getPathin classAbstractOrigin<Path, AbstractOrigin.PathOrigin>- Returns:
- this origin as a Path, if possible.
-