Class StringInputStreamProvider
- java.lang.Object
-
- com.helger.commons.io.streamprovider.StringInputStreamProvider
-
- All Implemented Interfaces:
IHasInputStream,IHasInputStreamAndReader,IHasReader
public class StringInputStreamProvider extends Object implements IHasInputStreamAndReader, IHasReader
AnInputStreamprovider based on aString.- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description StringInputStreamProvider(char[] aChars, int nOfs, int nLen, Charset aCharset)StringInputStreamProvider(char[] aChars, Charset aCharset)StringInputStreamProvider(CharSequence aData, Charset aCharset)StringInputStreamProvider(String sData, Charset aCharset)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)CharsetgetCharset()StringgetData()StringInputStreamgetInputStream()Get the input stream to read from the object.NonBlockingStringReadergetReader()Get the reader to read from the object.NonBlockingStringReadergetReader(Charset aCharset)Get aReaderbased on this input stream provider using the given charset.inthashCode()booleanisReadMultiple()Check if theInputStreamfromIHasInputStream.getInputStream()andIHasInputStream.getBufferedInputStream()can be acquired more than once.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.commons.io.IHasInputStream
getBufferedInputStream
-
Methods inherited from interface com.helger.commons.io.IHasInputStreamAndReader
getBufferedReader
-
Methods inherited from interface com.helger.commons.io.IHasReader
getBufferedReader
-
-
-
-
Constructor Detail
-
StringInputStreamProvider
public StringInputStreamProvider(@Nonnull char[] aChars, @Nonnull Charset aCharset)
-
StringInputStreamProvider
public StringInputStreamProvider(@Nonnull char[] aChars, @Nonnegative int nOfs, @Nonnegative int nLen, @Nonnull Charset aCharset)
-
StringInputStreamProvider
public StringInputStreamProvider(@Nonnull CharSequence aData, @Nonnull Charset aCharset)
-
-
Method Detail
-
getInputStream
@Nonnull public final StringInputStream getInputStream()
Description copied from interface:IHasInputStreamGet the input stream to read from the object. Each time this method is called, a newInputStreamneeds to be created.- Specified by:
getInputStreamin interfaceIHasInputStream- Returns:
nullif resolving failed.
-
getReader
@Nonnull public final NonBlockingStringReader getReader(@Nonnull Charset aCharset)
Description copied from interface:IHasInputStreamAndReaderGet aReaderbased on this input stream provider using the given charset.- Specified by:
getReaderin interfaceIHasInputStreamAndReader- Parameters:
aCharset- The charset to use. May not benull.- Returns:
nullif no input stream could be retrieved.
-
getReader
@Nonnull public final NonBlockingStringReader getReader()
Description copied from interface:IHasReaderGet the reader to read from the object. Each time this method is call, a newReaderneeds to be created!- Specified by:
getReaderin interfaceIHasReader- Returns:
nullif resolving failed.
-
isReadMultiple
public final boolean isReadMultiple()
Description copied from interface:IHasInputStreamCheck if theInputStreamfromIHasInputStream.getInputStream()andIHasInputStream.getBufferedInputStream()can be acquired more than once.- Specified by:
isReadMultiplein interfaceIHasInputStream- Returns:
trueif the input stream can be acquired more than once,falseif not.
-
-