Java Code Examples for org.restlet.representation.Representation#getCharacterSet()

The following examples show how to use org.restlet.representation.Representation#getCharacterSet() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FormReader.java    From DeviceConnect-Android with MIT License 3 votes vote down vote up
/**
 * Constructor.<br>
 * In case the representation does not define a character set, the UTF-8
 * character set is used.
 * 
 * @param representation
 *            The web form content.
 * @param decode
 *            Indicates if the parameters should be decoded using the given
 *            character set.
 * @throws IOException
 *             if the stream of the representation could not be opened.
 */
public FormReader(Representation representation, boolean decode)
        throws IOException {
    this.decode = decode;
    this.stream = representation.getStream();
    this.separator = '&';

    if (representation.getCharacterSet() != null) {
        this.characterSet = representation.getCharacterSet();
    } else {
        this.characterSet = CharacterSet.UTF_8;
    }
}
 
Example 2
Source File: CharacterReadingListener.java    From DeviceConnect-Android with MIT License 2 votes vote down vote up
/**
 * Constructor. Uses a byte buffer of a given size.
 * 
 * @param source
 *            The source representation.
 * @param bufferSize
 *            The byte buffer to use.
 * @throws IOException
 */
public CharacterReadingListener(Representation source, int bufferSize)
        throws IOException {
    super(source, bufferSize);
    this.characterSet = source.getCharacterSet();
}