< prev index next >

src/java.desktop/share/classes/javax/imageio/stream/FileImageInputStream.java

Print this page

        

*** 32,43 **** import com.sun.imageio.stream.CloseableDisposerRecord; import com.sun.imageio.stream.StreamFinalizer; import sun.java2d.Disposer; /** ! * An implementation of <code>ImageInputStream</code> that gets its ! * input from a <code>File</code> or <code>RandomAccessFile</code>. * The file contents are assumed to be stable during the lifetime of * the object. * */ public class FileImageInputStream extends ImageInputStreamImpl { --- 32,43 ---- import com.sun.imageio.stream.CloseableDisposerRecord; import com.sun.imageio.stream.StreamFinalizer; import sun.java2d.Disposer; /** ! * An implementation of {@code ImageInputStream} that gets its ! * input from a {@code File} or {@code RandomAccessFile}. * The file contents are assumed to be stable during the lifetime of * the object. * */ public class FileImageInputStream extends ImageInputStreamImpl {
*** 49,92 **** /** The DisposerRecord that closes the underlying RandomAccessFile. */ private final CloseableDisposerRecord disposerRecord; /** ! * Constructs a <code>FileImageInputStream</code> that will read ! * from a given <code>File</code>. * * <p> The file contents must not change between the time this * object is constructed and the time of the last call to a read * method. * ! * @param f a <code>File</code> to read from. * ! * @exception IllegalArgumentException if <code>f</code> is ! * <code>null</code>. * @exception SecurityException if a security manager exists * and does not allow read access to the file. ! * @exception FileNotFoundException if <code>f</code> is a * directory or cannot be opened for reading for any other reason. * @exception IOException if an I/O error occurs. */ public FileImageInputStream(File f) throws FileNotFoundException, IOException { this(f == null ? null : new RandomAccessFile(f, "r")); } /** ! * Constructs a <code>FileImageInputStream</code> that will read ! * from a given <code>RandomAccessFile</code>. * * <p> The file contents must not change between the time this * object is constructed and the time of the last call to a read * method. * ! * @param raf a <code>RandomAccessFile</code> to read from. * ! * @exception IllegalArgumentException if <code>raf</code> is ! * <code>null</code>. */ public FileImageInputStream(RandomAccessFile raf) { if (raf == null) { throw new IllegalArgumentException("raf == null!"); } --- 49,92 ---- /** The DisposerRecord that closes the underlying RandomAccessFile. */ private final CloseableDisposerRecord disposerRecord; /** ! * Constructs a {@code FileImageInputStream} that will read ! * from a given {@code File}. * * <p> The file contents must not change between the time this * object is constructed and the time of the last call to a read * method. * ! * @param f a {@code File} to read from. * ! * @exception IllegalArgumentException if {@code f} is ! * {@code null}. * @exception SecurityException if a security manager exists * and does not allow read access to the file. ! * @exception FileNotFoundException if {@code f} is a * directory or cannot be opened for reading for any other reason. * @exception IOException if an I/O error occurs. */ public FileImageInputStream(File f) throws FileNotFoundException, IOException { this(f == null ? null : new RandomAccessFile(f, "r")); } /** ! * Constructs a {@code FileImageInputStream} that will read ! * from a given {@code RandomAccessFile}. * * <p> The file contents must not change between the time this * object is constructed and the time of the last call to a read * method. * ! * @param raf a {@code RandomAccessFile} to read from. * ! * @exception IllegalArgumentException if {@code raf} is ! * {@code null}. */ public FileImageInputStream(RandomAccessFile raf) { if (raf == null) { throw new IllegalArgumentException("raf == null!"); }
*** 120,134 **** } return nbytes; } /** ! * Returns the length of the underlying file, or <code>-1</code> * if it is unknown. * ! * @return the file length as a <code>long</code>, or ! * <code>-1</code>. */ public long length() { try { checkClosed(); return raf.length(); --- 120,134 ---- } return nbytes; } /** ! * Returns the length of the underlying file, or {@code -1} * if it is unknown. * ! * @return the file length as a {@code long}, or ! * {@code -1}. */ public long length() { try { checkClosed(); return raf.length();
< prev index next >