Package com.helger.io.resource.inmemory
Class ReadableResourceString
java.lang.Object
com.helger.io.resource.inmemory.AbstractMemoryReadableResource
com.helger.io.resource.inmemory.ReadableResourceByteArray
com.helger.io.resource.inmemory.ReadableResourceString
- All Implemented Interfaces:
com.helger.base.iface.IHasSize,com.helger.base.io.iface.IHasByteArray,com.helger.base.io.iface.IHasInputStream,com.helger.base.io.iface.IHasInputStreamAndReader,com.helger.base.io.iface.IWriteToStream,IMemoryReadableResource,IReadableResource,IResourceBase
An in-memory
IReadableResource based on a String which is converted to a byte
array with the provided charset.- Author:
- Philip Helger
-
Field Summary
Fields inherited from class com.helger.io.resource.inmemory.ReadableResourceByteArray
DEFAULT_COPY_NEEDED -
Constructor Summary
ConstructorsConstructorDescriptionReadableResourceString(@NonNull String sString, @NonNull Charset aCharset) Constructor with automatic resource ID.ReadableResourceString(@Nullable String sResourceID, @NonNull String sString, @NonNull Charset aCharset) Constructor with explicit resource ID. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull ReadableResourceStringFactory method to create a UTF-8 encoded readable resource string.static @NonNull ReadableResourceStringFactory method to create a UTF-8 encoded readable resource string with a custom resource ID.Methods inherited from class com.helger.io.resource.inmemory.ReadableResourceByteArray
bytes, getInputStream, getOffset, isCopy, isEmpty, isReadMultiple, size, toStringMethods inherited from class com.helger.io.resource.inmemory.AbstractMemoryReadableResource
exists, getAsFile, getAsURL, getPath, getReadableCloneForPath, getResourceID, setPathMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.base.io.iface.IHasByteArray
getAllBytes, getBytesAsString, getHexEncoded, hasOffset, isNotEmpty, isPartialArray, startsWith, writeToMethods inherited from interface com.helger.base.io.iface.IHasInputStream
getBufferedInputStream, withBufferedInputStreamDo, withInputStreamDoMethods inherited from interface com.helger.base.io.iface.IHasInputStreamAndReader
getBufferedReader, getReaderMethods inherited from interface com.helger.base.io.iface.IWriteToStream
writeToAndClose
-
Constructor Details
-
ReadableResourceString
Constructor with automatic resource ID.- Parameters:
sString- The string content. May not benull.aCharset- The charset to use for converting the string to bytes. May not benull.
-
ReadableResourceString
public ReadableResourceString(@Nullable String sResourceID, @NonNull String sString, @NonNull Charset aCharset) Constructor with explicit resource ID.- Parameters:
sResourceID- The resource ID. May benull.sString- The string content. May not benull.aCharset- The charset to use for converting the string to bytes. May not benull.
-
-
Method Details
-
utf8
Factory method to create a UTF-8 encoded readable resource string.- Parameters:
sString- The string content. May not benull.- Returns:
- A new
ReadableResourceStringinstance. Nevernull.
-
utf8
public static @NonNull ReadableResourceString utf8(@Nullable String sResourceID, @NonNull String sString) Factory method to create a UTF-8 encoded readable resource string with a custom resource ID.- Parameters:
sResourceID- The resource ID. May benull.sString- The string content. May not benull.- Returns:
- A new
ReadableResourceStringinstance. Nevernull.
-