|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.me.parabola.imgfmt.app.BufferedImgFileWriter
public class BufferedImgFileWriter
A straight forward implementation that just keeps all the data in a buffer until the file needs to be written to disk.
Constructor Summary | |
---|---|
BufferedImgFileWriter(ImgChannel chan)
|
Method Summary | |
---|---|
void |
close()
Called when the stream is closed. |
java.nio.ByteBuffer |
getBuffer()
|
long |
getSize()
Get the size of the file as written. |
int |
position()
Get the position. |
void |
position(long pos)
Set the position of the file. |
void |
put(byte b)
Write out a single byte. |
void |
put(byte[] val)
Write out an arbitrary length sequence of bytes. |
void |
put(byte[] src,
int start,
int length)
Write out part of a byte array. |
void |
put3(int val)
Write out a 3 byte value in the correct byte order etc. |
void |
putChar(char c)
Write out two bytes. |
void |
putInt(int val)
Write out 4 byte value. |
void |
setMaxSize(long maxSize)
|
void |
sync()
Called to write out any saved buffers. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BufferedImgFileWriter(ImgChannel chan)
Method Detail |
---|
public void sync() throws java.io.IOException
sync
in interface ImgFileWriter
java.io.IOException
- If there is an error writing.public int position()
position
in interface ImgFileWriter
public void position(long pos)
position
in interface ImgFileWriter
pos
- The new position in the file.public void close() throws java.io.IOException
close
in interface java.io.Closeable
java.io.IOException
public void put(byte b)
put
in interface ImgFileWriter
b
- The byte to write.public void putChar(char c)
putChar
in interface ImgFileWriter
c
- The value to write.public void put3(int val)
put3
in interface ImgFileWriter
val
- The value to write.public void putInt(int val)
putInt
in interface ImgFileWriter
val
- The value to write.public void put(byte[] val)
put
in interface ImgFileWriter
val
- The values to write.public void put(byte[] src, int start, int length)
put
in interface ImgFileWriter
src
- The array to take bytes from.start
- The start position.length
- The number of bytes to write.public long getSize()
getSize
in interface ImgFileWriter
public java.nio.ByteBuffer getBuffer()
public void setMaxSize(long maxSize)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |