FileImageOutputStream (Java SE 15 & JDK 15) (original) (raw)
All Implemented Interfaces:
[Closeable](../../../../java.base/java/io/Closeable.html "interface in java.io")
, [DataInput](../../../../java.base/java/io/DataInput.html "interface in java.io")
, [DataOutput](../../../../java.base/java/io/DataOutput.html "interface in java.io")
, [AutoCloseable](../../../../java.base/java/lang/AutoCloseable.html "interface in java.lang")
, [ImageInputStream](ImageInputStream.html "interface in javax.imageio.stream")
, [ImageOutputStream](ImageOutputStream.html "interface in javax.imageio.stream")
public class FileImageOutputStream extends ImageOutputStreamImpl
An implementation of ImageOutputStream
that writes its output directly to a File
orRandomAccessFile
.
Field Summary
Constructor Summary
Constructors
Constructor | Description |
---|---|
FileImageOutputStream(File f) | Constructs a FileImageOutputStream that will write to a given File. |
FileImageOutputStream(RandomAccessFile raf) | Constructs a FileImageOutputStream that will write to a given RandomAccessFile. |
Method Summary
Modifier and Type | Method | Description |
---|---|---|
protected void | finalize() | Deprecated. |
void | seek(long pos) | Sets the current stream position and resets the bit offset to 0. |
Methods declared in class javax.imageio.stream.ImageInputStreamImpl
[checkClosed](ImageInputStreamImpl.html#checkClosed%28%29), [isCached](ImageInputStreamImpl.html#isCached%28%29), [isCachedFile](ImageInputStreamImpl.html#isCachedFile%28%29), [isCachedMemory](ImageInputStreamImpl.html#isCachedMemory%28%29), [length](ImageInputStreamImpl.html#length%28%29), [mark](ImageInputStreamImpl.html#mark%28%29), [read](ImageInputStreamImpl.html#read%28%29), [read](ImageInputStreamImpl.html#read%28byte%5B%5D%29), [read](ImageInputStreamImpl.html#read%28byte%5B%5D,int,int%29), [reset](ImageInputStreamImpl.html#reset%28%29), [skipBytes](ImageInputStreamImpl.html#skipBytes%28int%29), [skipBytes](ImageInputStreamImpl.html#skipBytes%28long%29)
Methods declared in interface javax.imageio.stream.ImageInputStream
[close](ImageInputStream.html#close%28%29), [flush](ImageInputStream.html#flush%28%29), [getBitOffset](ImageInputStream.html#getBitOffset%28%29), [getByteOrder](ImageInputStream.html#getByteOrder%28%29), [getFlushedPosition](ImageInputStream.html#getFlushedPosition%28%29), [getStreamPosition](ImageInputStream.html#getStreamPosition%28%29), [isCached](ImageInputStream.html#isCached%28%29), [isCachedFile](ImageInputStream.html#isCachedFile%28%29), [isCachedMemory](ImageInputStream.html#isCachedMemory%28%29), [length](ImageInputStream.html#length%28%29), [mark](ImageInputStream.html#mark%28%29), [read](ImageInputStream.html#read%28%29), [read](ImageInputStream.html#read%28byte%5B%5D%29), [read](ImageInputStream.html#read%28byte%5B%5D,int,int%29), [readBit](ImageInputStream.html#readBit%28%29), [readBits](ImageInputStream.html#readBits%28int%29), [readBoolean](ImageInputStream.html#readBoolean%28%29), [readByte](ImageInputStream.html#readByte%28%29), [readBytes](ImageInputStream.html#readBytes%28javax.imageio.stream.IIOByteBuffer,int%29), [readChar](ImageInputStream.html#readChar%28%29), [readDouble](ImageInputStream.html#readDouble%28%29), [readFloat](ImageInputStream.html#readFloat%28%29), [readFully](ImageInputStream.html#readFully%28byte%5B%5D%29), [readFully](ImageInputStream.html#readFully%28byte%5B%5D,int,int%29), [readFully](ImageInputStream.html#readFully%28char%5B%5D,int,int%29), [readFully](ImageInputStream.html#readFully%28double%5B%5D,int,int%29), [readFully](ImageInputStream.html#readFully%28float%5B%5D,int,int%29), [readFully](ImageInputStream.html#readFully%28int%5B%5D,int,int%29), [readFully](ImageInputStream.html#readFully%28long%5B%5D,int,int%29), [readFully](ImageInputStream.html#readFully%28short%5B%5D,int,int%29), [readInt](ImageInputStream.html#readInt%28%29), [readLine](ImageInputStream.html#readLine%28%29), [readLong](ImageInputStream.html#readLong%28%29), [readShort](ImageInputStream.html#readShort%28%29), [readUnsignedByte](ImageInputStream.html#readUnsignedByte%28%29), [readUnsignedInt](ImageInputStream.html#readUnsignedInt%28%29), [readUnsignedShort](ImageInputStream.html#readUnsignedShort%28%29), [readUTF](ImageInputStream.html#readUTF%28%29), [reset](ImageInputStream.html#reset%28%29), [setBitOffset](ImageInputStream.html#setBitOffset%28int%29), [setByteOrder](ImageInputStream.html#setByteOrder%28java.nio.ByteOrder%29), [skipBytes](ImageInputStream.html#skipBytes%28int%29), [skipBytes](ImageInputStream.html#skipBytes%28long%29)
Methods declared in interface javax.imageio.stream.ImageOutputStream
[flushBefore](ImageOutputStream.html#flushBefore%28long%29), [write](ImageOutputStream.html#write%28byte%5B%5D%29), [write](ImageOutputStream.html#write%28byte%5B%5D,int,int%29), [write](ImageOutputStream.html#write%28int%29), [writeBit](ImageOutputStream.html#writeBit%28int%29), [writeBits](ImageOutputStream.html#writeBits%28long,int%29), [writeBoolean](ImageOutputStream.html#writeBoolean%28boolean%29), [writeByte](ImageOutputStream.html#writeByte%28int%29), [writeBytes](ImageOutputStream.html#writeBytes%28java.lang.String%29), [writeChar](ImageOutputStream.html#writeChar%28int%29), [writeChars](ImageOutputStream.html#writeChars%28char%5B%5D,int,int%29), [writeChars](ImageOutputStream.html#writeChars%28java.lang.String%29), [writeDouble](ImageOutputStream.html#writeDouble%28double%29), [writeDoubles](ImageOutputStream.html#writeDoubles%28double%5B%5D,int,int%29), [writeFloat](ImageOutputStream.html#writeFloat%28float%29), [writeFloats](ImageOutputStream.html#writeFloats%28float%5B%5D,int,int%29), [writeInt](ImageOutputStream.html#writeInt%28int%29), [writeInts](ImageOutputStream.html#writeInts%28int%5B%5D,int,int%29), [writeLong](ImageOutputStream.html#writeLong%28long%29), [writeLongs](ImageOutputStream.html#writeLongs%28long%5B%5D,int,int%29), [writeShort](ImageOutputStream.html#writeShort%28int%29), [writeShorts](ImageOutputStream.html#writeShorts%28short%5B%5D,int,int%29), [writeUTF](ImageOutputStream.html#writeUTF%28java.lang.String%29)
Constructor Details
FileImageOutputStream
Constructs a
FileImageOutputStream
that will write to a givenFile
.
Parameters:
f
- aFile
to write to.
Throws:
[IllegalArgumentException](../../../../java.base/java/lang/IllegalArgumentException.html "class in java.lang")
- iff
isnull
.
[SecurityException](../../../../java.base/java/lang/SecurityException.html "class in java.lang")
- if a security manager exists and does not allow write access to the file.
[FileNotFoundException](../../../../java.base/java/io/FileNotFoundException.html "class in java.io")
- iff
does not denote a regular file or it cannot be opened for reading and writing for any other reason.
[IOException](../../../../java.base/java/io/IOException.html "class in java.io")
- if an I/O error occurs.FileImageOutputStream
Constructs a
FileImageOutputStream
that will write to a givenRandomAccessFile
.
Parameters:
raf
- aRandomAccessFile
to write to.
Throws:
[IllegalArgumentException](../../../../java.base/java/lang/IllegalArgumentException.html "class in java.lang")
- ifraf
isnull
.Method Details
seek
public void seek(long pos) throws IOException
Sets the current stream position and resets the bit offset to 0. It is legal to seeking past the end of the file; anEOFException
will be thrown only if a read is performed. The file length will not be increased until a write is performed.
Parameters:
pos
- along
containing the desired file pointer position.
Throws:
[IndexOutOfBoundsException](../../../../java.base/java/lang/IndexOutOfBoundsException.html "class in java.lang")
- ifpos
is smaller than the flushed position.
[IOException](../../../../java.base/java/io/IOException.html "class in java.io")
- if any other I/O error occurs.finalize
Finalizes this object prior to garbage collection. The
close
method is called to close any open input source. This method should not be called from application code.
Overrides:
[finalize](ImageInputStreamImpl.html#finalize%28%29)
in class[ImageInputStreamImpl](ImageInputStreamImpl.html "class in javax.imageio.stream")
Throws:
[Throwable](../../../../java.base/java/lang/Throwable.html "class in java.lang")
- if an error occurs during superclass finalization.
See Also:
WeakReference, PhantomReference