Java Code Examples for org.restlet.data.CharacterSet#UTF_8

The following examples show how to use org.restlet.data.CharacterSet#UTF_8 . 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: AbstractConverter.java    From ontopia with Apache License 2.0 5 votes vote down vote up
@Override
public Representation toRepresentation(final Object source, final Variant target, Resource resource) throws IOException {
	return new OutputRepresentation(target.getMediaType()) {
		@Override
		public void write(OutputStream outputStream) throws IOException {
			CharacterSet characterSet = target.getCharacterSet();
			if (characterSet == null) {
				characterSet = CharacterSet.UTF_8;
			}
			writeFragment(outputStream, source, characterSet);
		}
	};
}
 
Example 2
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 3
Source File: StringRepresentation.java    From DeviceConnect-Android with MIT License 2 votes vote down vote up
/**
 * Constructor. The following metadata are used by default: UTF-8 character
 * set.
 * 
 * @param text
 *            The string value.
 * @param mediaType
 *            The media type.
 * @param language
 *            The language.
 */
public StringRepresentation(CharSequence text, MediaType mediaType,
        Language language) {
    this(text, mediaType, language, CharacterSet.UTF_8);
}