All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gov.nasa.arc.pds.tools.container.URLContentsContainer Maven / Gradle / Ivy

There is a newer version: 2.8.4
Show newest version
package gov.nasa.arc.pds.tools.container;

import java.io.UnsupportedEncodingException;

/**
 * A container class for the contents of URL or URI.
 * 
 * @author jagander
 * @version $Revision: $
 * 
 */
public class URLContentsContainer implements BaseContainerInterface {

	private final byte[] bytes;

	private final String charset;

	public URLContentsContainer(final byte[] bytes, final String charset) {
		this.bytes = bytes;
		this.charset = charset;
	}

	public byte[] getBytes() {
		return this.bytes;
	}

	public String getCharset() {
		return this.charset;
	}

	@Override
	public String toString() {
		try {
			return new String(this.bytes, this.charset);
		} catch (UnsupportedEncodingException e) {
			return new String(this.bytes);
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy