< prev index next >
src/java.desktop/share/classes/javax/imageio/stream/FileImageOutputStream.java
Print this page
*** 32,44 ****
import com.sun.imageio.stream.CloseableDisposerRecord;
import com.sun.imageio.stream.StreamFinalizer;
import sun.java2d.Disposer;
/**
! * An implementation of <code>ImageOutputStream</code> that writes its
! * output directly to a <code>File</code> or
! * <code>RandomAccessFile</code>.
*
*/
public class FileImageOutputStream extends ImageOutputStreamImpl {
private RandomAccessFile raf;
--- 32,44 ----
import com.sun.imageio.stream.CloseableDisposerRecord;
import com.sun.imageio.stream.StreamFinalizer;
import sun.java2d.Disposer;
/**
! * An implementation of {@code ImageOutputStream} that writes its
! * output directly to a {@code File} or
! * {@code RandomAccessFile}.
*
*/
public class FileImageOutputStream extends ImageOutputStreamImpl {
private RandomAccessFile raf;
*** 48,84 ****
/** The DisposerRecord that closes the underlying RandomAccessFile. */
private final CloseableDisposerRecord disposerRecord;
/**
! * Constructs a <code>FileImageOutputStream</code> that will write
! * to a given <code>File</code>.
*
! * @param f a <code>File</code> to write to.
*
! * @exception IllegalArgumentException if <code>f</code> is
! * <code>null</code>.
* @exception SecurityException if a security manager exists
* and does not allow write access to the file.
! * @exception FileNotFoundException if <code>f</code> does not denote
* a regular file or it cannot be opened for reading and writing for any
* other reason.
* @exception IOException if an I/O error occurs.
*/
public FileImageOutputStream(File f)
throws FileNotFoundException, IOException {
this(f == null ? null : new RandomAccessFile(f, "rw"));
}
/**
! * Constructs a <code>FileImageOutputStream</code> that will write
! * to a given <code>RandomAccessFile</code>.
*
! * @param raf a <code>RandomAccessFile</code> to write to.
*
! * @exception IllegalArgumentException if <code>raf</code> is
! * <code>null</code>.
*/
public FileImageOutputStream(RandomAccessFile raf) {
if (raf == null) {
throw new IllegalArgumentException("raf == null!");
}
--- 48,84 ----
/** The DisposerRecord that closes the underlying RandomAccessFile. */
private final CloseableDisposerRecord disposerRecord;
/**
! * Constructs a {@code FileImageOutputStream} that will write
! * to a given {@code File}.
*
! * @param f a {@code File} to write to.
*
! * @exception IllegalArgumentException if {@code f} is
! * {@code null}.
* @exception SecurityException if a security manager exists
* and does not allow write access to the file.
! * @exception FileNotFoundException if {@code f} does not denote
* a regular file or it cannot be opened for reading and writing for any
* other reason.
* @exception IOException if an I/O error occurs.
*/
public FileImageOutputStream(File f)
throws FileNotFoundException, IOException {
this(f == null ? null : new RandomAccessFile(f, "rw"));
}
/**
! * Constructs a {@code FileImageOutputStream} that will write
! * to a given {@code RandomAccessFile}.
*
! * @param raf a {@code RandomAccessFile} to write to.
*
! * @exception IllegalArgumentException if {@code raf} is
! * {@code null}.
*/
public FileImageOutputStream(RandomAccessFile raf) {
if (raf == null) {
throw new IllegalArgumentException("raf == null!");
}
*** 135,149 ****
}
/**
* Sets the current stream position and resets the bit offset to
* 0. It is legal to seeking past the end of the file; an
! * <code>EOFException</code> will be thrown only if a read is
* performed. The file length will not be increased until a write
* is performed.
*
! * @exception IndexOutOfBoundsException if <code>pos</code> is smaller
* than the flushed position.
* @exception IOException if any other I/O error occurs.
*/
public void seek(long pos) throws IOException {
checkClosed();
--- 135,149 ----
}
/**
* Sets the current stream position and resets the bit offset to
* 0. It is legal to seeking past the end of the file; an
! * {@code EOFException} will be thrown only if a read is
* performed. The file length will not be increased until a write
* is performed.
*
! * @exception IndexOutOfBoundsException if {@code pos} is smaller
* than the flushed position.
* @exception IOException if any other I/O error occurs.
*/
public void seek(long pos) throws IOException {
checkClosed();
< prev index next >