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

org.openstack4j.model.common.payloads.InputStreamPayload Maven / Gradle / Ivy

There is a newer version: 3.2.0
Show newest version
package org.openstack4j.model.common.payloads;

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

import org.openstack4j.model.common.Payload;

/**
 * Input Stream Payload
 * 
 * @author Jeremy Unruh
 */
public class InputStreamPayload implements Payload{

	private InputStream is;
	
	public InputStreamPayload(InputStream is) {
		this.is = is;
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	public void close() throws IOException {
		if (is != null)
			is.close();
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public InputStream open() {
		return is;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public void closeQuietly() {
		  try {
				close();
			}
			catch (IOException e) {
			}
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public InputStream getRaw() {
		return is;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy