Class ByteArrayInputStreamProvider
java.lang.Object
com.helger.commons.io.streamprovider.ByteArrayInputStreamProvider
- All Implemented Interfaces:
IHasByteArray,IHasInputStream,IHasInputStreamAndReader,IHasSize
An
InputStream provider based on a byte array.- Author:
- Philip Helger
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionByteArrayInputStreamProvider(byte[] aData) ByteArrayInputStreamProvider(byte[] aData, boolean bCopyNeeded) ByteArrayInputStreamProvider(byte[] aData, int nOfs, int nLen) ByteArrayInputStreamProvider(byte[] aData, int nOfs, int nLen, boolean bCopyNeeded) -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.commons.io.IHasByteArray
getAllBytes, getBytesAsString, getHexEncoded, getInputStream, hasOffset, isEmpty, isNotEmpty, isPartialArray, isReadMultiple, startsWith, writeToMethods inherited from interface com.helger.commons.io.IHasInputStream
getBufferedInputStream, withBufferedInputStreamDo, withInputStreamDoMethods inherited from interface com.helger.commons.io.IHasInputStreamAndReader
getBufferedReader, getReader
-
Field Details
-
DEFAULT_COPY_NEEDED
public static final boolean DEFAULT_COPY_NEEDED- See Also:
-
-
Constructor Details
-
ByteArrayInputStreamProvider
-
ByteArrayInputStreamProvider
-
ByteArrayInputStreamProvider
public ByteArrayInputStreamProvider(@Nonnull byte[] aData, @Nonnegative int nOfs, @Nonnegative int nLen) -
ByteArrayInputStreamProvider
public ByteArrayInputStreamProvider(@Nonnull byte[] aData, @Nonnegative int nOfs, @Nonnegative int nLen, boolean bCopyNeeded)
-
-
Method Details
-
isCopy
public final boolean isCopy()- Specified by:
isCopyin interfaceIHasByteArray- Returns:
trueif the contained byte array was copied in the constructor or not.
-
bytes
- Specified by:
bytesin interfaceIHasByteArray- Returns:
- A reference to the contained byte array. Gives write access to the
payload! Don't forget to apply
IHasByteArray.getOffset()andIHasSize.size(). Nevernull.
-
getOffset
- Specified by:
getOffsetin interfaceIHasByteArray- Returns:
- The offset into the byte array to start reading. This is always 0 when copied. Must be ge; 0.
- See Also:
-
size
-
toString
-