public class FileChannelImageOutputStream
extends javax.imageio.stream.ImageOutputStreamImpl
ImageOutputStream using a
FileChannel as the eventual data destination.
Memory mapping is used for reading and direct buffers for writing. Only methods which provide significant performance improvement with respect to the superclass implementation are overridden. Overridden methods are not commented individually unless some noteworthy aspect of the implementation must be described.
The methods of this class are not synchronized.
ImageOutputStream,
java.nio,
FileChannel| Constructor and Description |
|---|
FileChannelImageOutputStream(java.nio.channels.FileChannel channel)
Constructs a
FileChannelImageOutputStream from a
FileChannel. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Invokes the superclass method, writes any unwritten data, and
sets the internal reference to the source
FileChannel
to null. |
long |
length()
Returns the number of bytes currently in the
FileChannel. |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
readFully(char[] c,
int off,
int len) |
void |
readFully(double[] d,
int off,
int len) |
void |
readFully(float[] f,
int off,
int len) |
void |
readFully(int[] i,
int off,
int len) |
void |
readFully(long[] l,
int off,
int len) |
void |
readFully(short[] s,
int off,
int len) |
void |
seek(long pos)
Invokes the superclass method, writes any unwritten data,
and sets the channel position to the supplied parameter.
|
void |
setByteOrder(java.nio.ByteOrder networkByteOrder) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
void |
writeChars(char[] c,
int off,
int len) |
void |
writeDoubles(double[] d,
int off,
int len) |
void |
writeFloats(float[] f,
int off,
int len) |
void |
writeInts(int[] i,
int off,
int len) |
void |
writeLongs(long[] l,
int off,
int len) |
void |
writeShorts(short[] s,
int off,
int len) |
flushBits, write, writeBit, writeBits, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTFcheckClosed, finalize, flush, flushBefore, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, isCached, isCachedFile, isCachedMemory, mark, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, reset, setBitOffset, skipBytes, skipBytesclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitflush, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, isCached, isCachedFile, isCachedMemory, mark, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, reset, setBitOffset, skipBytes, skipBytespublic FileChannelImageOutputStream(java.nio.channels.FileChannel channel)
throws java.io.IOException
FileChannelImageOutputStream from a
FileChannel. The initial position of the stream
stream is taken to be the position of the FileChannel
parameter when this constructor is invoked. The stream and flushed
positions are therefore both initialized to
channel.position().channel - the destination FileChannel.java.lang.IllegalArgumentException - if channel is
null or is not open.java.io.IOException - if a method invoked on channel
throws an IOException.public int read()
throws java.io.IOException
read in interface javax.imageio.stream.ImageInputStreamread in class javax.imageio.stream.ImageInputStreamImpljava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in interface javax.imageio.stream.ImageInputStreamread in class javax.imageio.stream.ImageInputStreamImpljava.io.IOExceptionpublic void write(int b)
throws java.io.IOException
write in interface java.io.DataOutputwrite in interface javax.imageio.stream.ImageOutputStreamwrite in class javax.imageio.stream.ImageOutputStreamImpljava.io.IOExceptionpublic void write(byte[] b,
int off,
int len)
throws java.io.IOException
write in interface java.io.DataOutputwrite in interface javax.imageio.stream.ImageOutputStreamwrite in class javax.imageio.stream.ImageOutputStreamImpljava.io.IOExceptionpublic void readFully(char[] c,
int off,
int len)
throws java.io.IOException
readFully in interface javax.imageio.stream.ImageInputStreamreadFully in class javax.imageio.stream.ImageInputStreamImpljava.io.IOExceptionpublic void readFully(short[] s,
int off,
int len)
throws java.io.IOException
readFully in interface javax.imageio.stream.ImageInputStreamreadFully in class javax.imageio.stream.ImageInputStreamImpljava.io.IOExceptionpublic void readFully(int[] i,
int off,
int len)
throws java.io.IOException
readFully in interface javax.imageio.stream.ImageInputStreamreadFully in class javax.imageio.stream.ImageInputStreamImpljava.io.IOExceptionpublic void readFully(long[] l,
int off,
int len)
throws java.io.IOException
readFully in interface javax.imageio.stream.ImageInputStreamreadFully in class javax.imageio.stream.ImageInputStreamImpljava.io.IOExceptionpublic void readFully(float[] f,
int off,
int len)
throws java.io.IOException
readFully in interface javax.imageio.stream.ImageInputStreamreadFully in class javax.imageio.stream.ImageInputStreamImpljava.io.IOExceptionpublic void readFully(double[] d,
int off,
int len)
throws java.io.IOException
readFully in interface javax.imageio.stream.ImageInputStreamreadFully in class javax.imageio.stream.ImageInputStreamImpljava.io.IOExceptionpublic void writeChars(char[] c,
int off,
int len)
throws java.io.IOException
writeChars in interface javax.imageio.stream.ImageOutputStreamwriteChars in class javax.imageio.stream.ImageOutputStreamImpljava.io.IOExceptionpublic void writeShorts(short[] s,
int off,
int len)
throws java.io.IOException
writeShorts in interface javax.imageio.stream.ImageOutputStreamwriteShorts in class javax.imageio.stream.ImageOutputStreamImpljava.io.IOExceptionpublic void writeInts(int[] i,
int off,
int len)
throws java.io.IOException
writeInts in interface javax.imageio.stream.ImageOutputStreamwriteInts in class javax.imageio.stream.ImageOutputStreamImpljava.io.IOExceptionpublic void writeLongs(long[] l,
int off,
int len)
throws java.io.IOException
writeLongs in interface javax.imageio.stream.ImageOutputStreamwriteLongs in class javax.imageio.stream.ImageOutputStreamImpljava.io.IOExceptionpublic void writeFloats(float[] f,
int off,
int len)
throws java.io.IOException
writeFloats in interface javax.imageio.stream.ImageOutputStreamwriteFloats in class javax.imageio.stream.ImageOutputStreamImpljava.io.IOExceptionpublic void writeDoubles(double[] d,
int off,
int len)
throws java.io.IOException
writeDoubles in interface javax.imageio.stream.ImageOutputStreamwriteDoubles in class javax.imageio.stream.ImageOutputStreamImpljava.io.IOExceptionpublic void close()
throws java.io.IOException
FileChannel
to null. The source FileChannel is not
closed.close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface javax.imageio.stream.ImageInputStreamclose in class javax.imageio.stream.ImageInputStreamImpljava.io.IOException - if an error occurs.public long length()
FileChannel.
If an IOException is encountered when querying the
channel's size, -1L will be returned.length in interface javax.imageio.stream.ImageInputStreamlength in class javax.imageio.stream.ImageInputStreamImplpublic void seek(long pos)
throws java.io.IOException
seek in interface javax.imageio.stream.ImageInputStreamseek in class javax.imageio.stream.ImageInputStreamImpljava.io.IOExceptionpublic void setByteOrder(java.nio.ByteOrder networkByteOrder)
setByteOrder in interface javax.imageio.stream.ImageInputStreamsetByteOrder in class javax.imageio.stream.ImageInputStreamImplCopyright © 2014 Open Microscopy Environment