public class JsonRepresentation extends Representation
UNKNOWN_SIZE
Constructor and Description |
---|
JsonRepresentation(MediaType mediaType)
Constructor for an empty document.
|
JsonRepresentation(MediaType mediaType,
JSONValue value)
Constructor from an existing DOM document.
|
JsonRepresentation(Representation jsonRepresentation)
Constructor.
|
JsonRepresentation(String jsonString)
Constructor from a JSON string.
|
Modifier and Type | Method and Description |
---|---|
JSONArray |
getJsonArray()
Converts the representation to a JSON array.
|
JSONBoolean |
getJsonBoolean()
Converts the representation to a JSON Boolean.
|
JSONNull |
getJsonNull()
Converts the representation to a JSON null value.
|
JSONObject |
getJsonObject()
Converts the representation to a JSON object.
|
JSONString |
getJsonString()
Converts the representation to a JSON string.
|
Reader |
getReader() |
long |
getSize() |
InputStream |
getStream() |
String |
getText() |
JSONValue |
getValue()
Returns the wrapped JSON value.
|
void |
release()
Releases the wrapped JSON value and the source JSON representation if
they have been defined.
|
void |
setValue(JSONValue json)
Sets the wrapped JSON value.
|
append, exhaust, getAvailableSize, getDisposition, getExpirationDate, getRange, hasKnownSize, isAvailable, isEmpty, isTransient, setAvailable, setDisposition, setExpirationDate, setRange, setSize, setTransient
getModificationDate, getTag, setModificationDate, setTag
createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, hashCode, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toString
public JsonRepresentation(MediaType mediaType)
mediaType
- The representation's media type.public JsonRepresentation(MediaType mediaType, JSONValue value)
mediaType
- The representation's media type.value
- The source JSON value.public JsonRepresentation(Representation jsonRepresentation)
jsonRepresentation
- A source JSON representation to parse.public JsonRepresentation(String jsonString)
jsonString
- The JSON string.public JSONArray getJsonArray() throws IOException
IOException
public JSONBoolean getJsonBoolean() throws IOException
IOException
public JSONNull getJsonNull() throws IOException
IOException
public JSONObject getJsonObject() throws IOException
IOException
public JSONString getJsonString() throws IOException
IOException
public Reader getReader() throws IOException
getReader
in class Representation
IOException
public long getSize()
getSize
in class Representation
public InputStream getStream() throws IOException
getStream
in class Representation
IOException
public String getText() throws IOException
getText
in class Representation
IOException
public JSONValue getValue() throws IOException
IOException
public void release()
release
in class Representation
public void setValue(JSONValue json)
json
- The wrapped JSON value.Copyright © 2005-2017 Restlet.