public class FileImageInputStream extends ImageInputStreamImpl
ImageInputStream被输入一个
File或
RandomAccessFile实施。文件内容被假定为在对象的生命期是稳定的。
bitOffset, byteOrder, flushedPos, streamPos| Constructor and Description |
|---|
FileImageInputStream(File f)
构建了一个
FileImageInputStream将从一个给定的
File读。
|
FileImageInputStream(RandomAccessFile raf)
构建了一个
FileImageInputStream将从一个给定的
RandomAccessFile读。
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
关闭流。
|
protected void |
finalize()
完成这个对象的垃圾收集之前。
|
long |
length()
返回指定文件的长度,或如果它是未知的
-1。
|
int |
read()
从流中读取一个字节并返回0和255之间的
int。
|
int |
read(byte[] b, int off, int len)
读到
len字节流,并将它们存储到
b从指数
off。
|
void |
seek(long pos)
将当前流位置设置为所需的位置。
|
checkClosed, flush, flushBefore, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, isCached, isCachedFile, isCachedMemory, mark, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, reset, setBitOffset, setByteOrder, skipBytes, skipBytespublic FileImageInputStream(File f) throws FileNotFoundException, IOException
FileImageInputStream将从一个给定的
File
该文件内容必须在该对象的时间和最后一个调用的时间之间改变。
读。f -
File读。
null
f
IllegalArgumentException。
SecurityException -如果存在一个安全管理,不允许对文件的读访问。
FileNotFoundException -如果
f是一个目录或不能打开任何其他原因阅读。
IOException如果I/O错误发生。
public FileImageInputStream(RandomAccessFile raf)
FileImageInputStream将从一个给定的
RandomAccessFile
该文件内容必须在该对象的时间和最后一个调用的时间之间改变。
读。raf -
RandomAccessFile读。
null
raf
IllegalArgumentException。
public int read()
throws IOException
ImageInputStreamImpl
int。如果达到
-1返回EOF。
子类必须为这种方法提供一个实现。子类实现应在退出之前更新流位置。
在流中的位偏移量必须在读取发生之前重置为零。
read 接口
ImageInputStream
read 方法重写,继承类
ImageInputStreamImpl
-1 EOF。
IOException如果流已关闭。
public int read(byte[] b,
int off,
int len)
throws IOException
ImageInputStreamImpl
len字节流,并将它们存储到
b从指数
off。如果没有字节可以读取因为已到达流的末尾,则返回
-1。
在流中的位偏移量必须在读取发生之前重置为零。
子类必须为这种方法提供一个实现。子类实现应在退出之前更新流位置。
read 接口
ImageInputStream
read 方法重写,继承类
ImageInputStreamImpl
b -字节被写入到数组。
off -起始位置在
b写。
len -的最大字节数读。
-1指示EOF。
IOException如果I/O错误发生。
public long length()
-1。
length 接口
ImageInputStream
length 方法重写,继承类
ImageInputStreamImpl
long,或
-1。
public void seek(long pos)
throws IOException
ImageInputStream
如果将一个IndexOutOfBoundsException pos小于冲洗位置抛出(返回的getflushedPosition)。
它寻找过去的文件是合法的;一个java.io.EOFException才可以执行读扔。
seek 接口
ImageInputStream
seek 方法重写,继承类
ImageInputStreamImpl
pos -
long含有所需的文件指针的位置。
IOException -如果任何其他发生I/O错误。
public void close()
throws IOException
ImageInputStream
IOExceptions或不正确的行为。调用此方法可允许类实现此接口,以释放与流关联的资源,如内存、磁盘空间或文件描述符。
close 接口
Closeable
close 接口
AutoCloseable
close 接口
ImageInputStream
close 方法重写,继承类
ImageInputStreamImpl
IOException如果I/O错误发生。
protected void finalize()
throws Throwable
close方法来关闭任何打开的输入源。此方法不应该从应用程序代码调用。
finalize 方法重写,继承类
ImageInputStreamImpl
Throwable -如果在父类定型时发生错误。
WeakReference,
PhantomReference
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.