it.geosolutions.imageio.stream.output
Class FileImageOutputStreamExtImpl

Object
  extended by ImageInputStreamImpl
      extended by ImageOutputStreamImpl
          extended by FileImageOutputStreamExtImpl
All Implemented Interfaces:
FileImageOutputStreamExt, DataInput, DataOutput, ImageInputStream, ImageOutputStream

public class FileImageOutputStreamExtImpl
extends ImageOutputStreamImpl
implements FileImageOutputStreamExt

An implementation of ImageOutputStream that take its output on a File.

Author:
Daniele Romagnoli, GeoSolutions, Simone Giannecchini, GeoSolutions

Field Summary
 
Fields inherited from class ImageInputStreamImpl
bitOffset, byteOrder, flushedPos, streamPos
 
Constructor Summary
FileImageOutputStreamExtImpl(File file)
          A constructor which accepts a File as input.
FileImageOutputStreamExtImpl(File file, int bufSize)
          A constructor which accepts a File as input.
 
Method Summary
 void close()
          Closes the underlying EnhancedRandomAccessFile.
 void dispose()
          Disposes this FileImageInputStreamExtImpl by closing its underlying EnhancedRandomAccessFile.
 File getFile()
          Retrieves the File we are connected to.
 long length()
           
 int read()
           
 int read(byte[] b, int off, int len)
           
 void seek(long pos)
          Sets the current stream position and resets the bit offset to 0.
 String toString()
          Provides a simple description for this ImageOutputStream.
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class ImageOutputStreamImpl
flushBits, write, writeBit, writeBits, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeChars, writeDouble, writeDoubles, writeFloat, writeFloats, writeInt, writeInts, writeLong, writeLongs, writeShort, writeShorts, writeUTF
 
Methods inherited from class ImageInputStreamImpl
checkClosed, finalize, 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, skipBytes
 
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ImageOutputStream
flushBefore, write, writeBit, writeBits, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeChars, writeDouble, writeDoubles, writeFloat, writeFloats, writeInt, writeInts, writeLong, writeLongs, writeShort, writeShorts, writeUTF
 
Methods inherited from interface ImageInputStream
flush, 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, skipBytes
 

Constructor Detail

FileImageOutputStreamExtImpl

public FileImageOutputStreamExtImpl(File file)
                             throws FileNotFoundException,
                                    IOException
A constructor which accepts a File as input.

Parameters:
eraf -
Throws:
FileNotFoundException
IOException

FileImageOutputStreamExtImpl

public FileImageOutputStreamExtImpl(File file,
                                    int bufSize)
                             throws FileNotFoundException,
                                    IOException
A constructor which accepts a File as input.

Parameters:
eraf -
bufSize -
Throws:
FileNotFoundException
IOException
Method Detail

read

public int read()
         throws IOException
Specified by:
read in interface ImageInputStream
Specified by:
read in class ImageInputStreamImpl
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Specified by:
read in interface ImageInputStream
Specified by:
read in class ImageInputStreamImpl
Throws:
IOException

write

public void write(int b)
           throws IOException
Specified by:
write in interface DataOutput
Specified by:
write in interface ImageOutputStream
Specified by:
write in class ImageOutputStreamImpl
Throws:
IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Specified by:
write in interface DataOutput
Specified by:
write in interface ImageOutputStream
Specified by:
write in class ImageOutputStreamImpl
Throws:
IOException

length

public long length()
Specified by:
length in interface ImageInputStream
Overrides:
length in class ImageInputStreamImpl

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 eraf; an EOFException will be thrown only if a read is performed. The eraf length will not be increased until a write is performed.

Specified by:
seek in interface ImageInputStream
Overrides:
seek in class ImageInputStreamImpl
Throws:
IndexOutOfBoundsException - if pos is smaller than the flushed position.
IOException - if any other I/O error occurs.

close

public void close()
           throws IOException
Closes the underlying EnhancedRandomAccessFile.

Specified by:
close in interface ImageInputStream
Overrides:
close in class ImageInputStreamImpl
Throws:
IOException - in case something bad happens.

getFile

public File getFile()
Retrieves the File we are connected to.

Specified by:
getFile in interface FileImageOutputStreamExt
Returns:
the associated File

dispose

public void dispose()
Disposes this FileImageInputStreamExtImpl by closing its underlying EnhancedRandomAccessFile.


toString

public String toString()
Provides a simple description for this ImageOutputStream.

Overrides:
toString in class Object
Returns:
a simple description for this ImageOutputStream.


Copyright © 2006-2010 GeoSolutions. All Rights Reserved.