public interface WebResource
You can use the create methods for simple resources when using ResourceService
.
It is assumed that any text based files are encoded in UTF-8.
Modifier and Type | Interface and Description |
---|---|
static class |
WebResource.ByteResource |
Modifier and Type | Method and Description |
---|---|
byte[] |
asBytes() |
java.io.InputStream |
asStream() |
java.lang.String |
asString()
Return the resource as a UTF-8 String.
|
static WebResource |
create(byte[] content)
Create a new WebResource from byte array.
|
static WebResource |
create(java.io.InputStream in)
Creates a new WebResource from an InputStream.
|
static WebResource |
create(java.lang.String utf8String)
Create a new WebResource from an UTF-8 String.
|
static WebResource create(byte[] content)
content
- Bytes of the resource.static WebResource create(java.lang.String utf8String)
utf8String
- String in UTF-8 encoding.static WebResource create(java.io.InputStream in) throws java.io.IOException
in
- InputStream for the resource, closed after inside the method.java.io.IOException
- If the stream can not be read.byte[] asBytes()
java.lang.String asString()
java.io.InputStream asStream()