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

com.adobe.internal.io.InputStreamByteReader Maven / Gradle / Ivy

There is a newer version: 2024.11.18751.20241128T090041Z-241100
Show newest version
package com.adobe.internal.io;

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

/**
 * A {@link com.adobe.internal.io.ByteReader ByteReader} that converts
 * a InputStream to either an array of bytes or a RandomAccessFile
 * before wrapping the data with a {@link com.adobe.internal.io.ByteReader ByteReader}.
 *
 * This class is not threadsafe.  It is not safe to pass an instance of this class
 * to multiple threads.  It is not safe to pass an instance of this class to multiple users even
 * if in the same thread.
 */
public class InputStreamByteReader extends ByteReaderWrapperImpl
{
	/**
	 * Creates a new InputStreamByteWriter from the given InputStream.
	 * This reads all of the bytes from the InputStream into memory and then
	 * wraps those bytes with a ByteArrayByteReader.  Once the constructor returns
	 * the stream will have been fully read and closed.
	 * @param inputStream the source of the bytes.
	 * @throws IOException
	 */
	public InputStreamByteReader(InputStream inputStream) throws IOException
	{        
		super(new InputStreamByteWriter(inputStream));
	}
	
	/**
	 * Creates a new InputStreamByteWriter from the given InputStream.
	 * This reads all of the bytes from the InputStream into the
	 * RandomAccessFile provided and then wraps that file with a
	 * RandomAccessFileByteReader.  Once the constructor returns
	 * the stream will have been fully read and closed.  The provided 
	 * RandomAccessFile must have read and write access.
	 * @param inputStream the source of the bytes.
	 * @param raf the location to buffer those bytes to.    
	 * @throws IOException
	 */
	public InputStreamByteReader(InputStream inputStream, RandomAccessFile raf) throws IOException
	{
		super(new InputStreamByteWriter(inputStream, raf));
	}	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy