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

wicket.contrib.tinymce.image.FileResourceStream Maven / Gradle / Ivy

There is a newer version: 6.30.0
Show newest version
package wicket.contrib.tinymce.image;

import java.io.IOException;
import java.io.InputStream;

import org.apache.wicket.util.resource.AbstractResourceStream;
import org.apache.wicket.util.resource.ResourceStreamNotFoundException;

/**
 * Resource stream for images.
 * 
 * @author Michal Letynski 
 */
public class FileResourceStream extends AbstractResourceStream
{

	private static final long serialVersionUID = 1L;

	private String contentType;
	private transient InputStream inputStream;

	public FileResourceStream(String pContentType, InputStream pInputStream)
	{
		inputStream = pInputStream;
		contentType = pContentType;
	}

	@Override
	public String getContentType()
	{
		return contentType;
	}

	/**
	 * {@inheritDoc}
	 */
	public InputStream getInputStream() throws ResourceStreamNotFoundException
	{
		return inputStream;
	}

	/**
	 * {@inheritDoc}
	 */
	public void close() throws IOException
	{
		if (inputStream != null)
		{
			inputStream.close();
			inputStream = null;
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy