Class ByteSource
- java.lang.Object
-
- org.apache.commons.imaging.bytesource.ByteSource
-
- Direct Known Subclasses:
InputStreamByteSource
public class ByteSource extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ByteSource(org.apache.commons.io.build.AbstractOrigin<?,?> origin, java.lang.String fileName)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ByteSourcearray(byte[] array)static ByteSourcearray(byte[] array, java.lang.String name)static ByteSourcefile(java.io.File file)byte[]getByteArray(long position, int length)java.lang.StringgetFileName()java.io.InputStreamgetInputStream()static java.io.InputStreamgetInputStream(ByteSource byteSource, long skip)static ByteSourceinputStream(java.io.InputStream is, java.lang.String name)static ByteSourcepath(java.nio.file.Path file)longsize()This operation can be VERY expensive; for InputStream byte sources, the entire stream must be drained to determine its length.java.lang.StringtoString()
-
-
-
Method Detail
-
array
public static ByteSource array(byte[] array)
-
array
public static ByteSource array(byte[] array, java.lang.String name)
-
file
public static ByteSource file(java.io.File file)
-
getInputStream
public static final java.io.InputStream getInputStream(ByteSource byteSource, long skip) throws java.io.IOException
- Throws:
java.io.IOException
-
inputStream
public static ByteSource inputStream(java.io.InputStream is, java.lang.String name) throws java.io.IOException
- Throws:
java.io.IOException
-
path
public static ByteSource path(java.nio.file.Path file)
-
getByteArray
public byte[] getByteArray(long position, int length) throws java.io.IOException- Throws:
java.io.IOException
-
getFileName
public final java.lang.String getFileName()
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException- Throws:
java.io.IOException
-
size
public long size() throws java.io.IOExceptionThis operation can be VERY expensive; for InputStream byte sources, the entire stream must be drained to determine its length.- Returns:
- the byte source length
- Throws:
java.io.IOException- if it fails to read the byte source data
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-