Package pixy.io
Class FileCacheRandomAccessOutputStream
java.lang.Object
java.io.OutputStream
pixy.io.RandomAccessOutputStream
pixy.io.FileCacheRandomAccessOutputStream
- All Implemented Interfaces:
java.io.Closeable
,java.io.DataOutput
,java.io.Flushable
,java.lang.AutoCloseable
public class FileCacheRandomAccessOutputStream extends RandomAccessOutputStream
-
Field Summary
-
Constructor Summary
Constructors Constructor Description FileCacheRandomAccessOutputStream(java.io.OutputStream dist)
FileCacheRandomAccessOutputStream(java.io.OutputStream dist, int bufLen)
-
Method Summary
Modifier and Type Method Description void
close()
Closes this stream and releases any system resources associated with the stream.void
disposeBefore(long pos)
long
getFlushPos()
long
getLength()
Returns the total length of data that has been cached, regardless of whether any early blocks have been disposed.long
getStreamPointer()
void
reset()
Reset this stream to be used againvoid
seek(long pos)
void
shallowClose()
Closes the RandomAccessInputStream and it's underlying streamvoid
write(byte[] b, int off, int len)
void
write(int value)
void
writeToStream(long len)
Methods inherited from class pixy.io.RandomAccessOutputStream
ensureOpen, finalize, getEndian, setWriteStrategy, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeS15Fixed16Number, writeShort, writeU16Fixed16Number, writeU8Fixed8Number, writeUTF
-
Constructor Details
-
FileCacheRandomAccessOutputStream
public FileCacheRandomAccessOutputStream(java.io.OutputStream dist) throws java.io.IOException- Throws:
java.io.IOException
-
FileCacheRandomAccessOutputStream
public FileCacheRandomAccessOutputStream(java.io.OutputStream dist, int bufLen) throws java.io.IOException- Throws:
java.io.IOException
-
-
Method Details
-
close
public void close() throws java.io.IOExceptionCloses this stream and releases any system resources associated with the stream.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classRandomAccessOutputStream
- Throws:
java.io.IOException
- if an I/O error occurs.
-
disposeBefore
public void disposeBefore(long pos)- Specified by:
disposeBefore
in classRandomAccessOutputStream
-
getFlushPos
public long getFlushPos()- Specified by:
getFlushPos
in classRandomAccessOutputStream
-
getLength
public long getLength()Description copied from class:RandomAccessOutputStream
Returns the total length of data that has been cached, regardless of whether any early blocks have been disposed. This value will only ever increase.- Specified by:
getLength
in classRandomAccessOutputStream
-
getStreamPointer
public long getStreamPointer()- Specified by:
getStreamPointer
in classRandomAccessOutputStream
- Returns:
- the current stream position
-
reset
public void reset()Description copied from class:RandomAccessOutputStream
Reset this stream to be used again- Specified by:
reset
in classRandomAccessOutputStream
-
seek
public void seek(long pos) throws java.io.IOException- Specified by:
seek
in classRandomAccessOutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException- Specified by:
write
in interfacejava.io.DataOutput
- Specified by:
write
in classRandomAccessOutputStream
- Throws:
java.io.IOException
-
write
public void write(int value) throws java.io.IOException- Specified by:
write
in interfacejava.io.DataOutput
- Specified by:
write
in classRandomAccessOutputStream
- Throws:
java.io.IOException
-
writeToStream
public void writeToStream(long len) throws java.io.IOException- Specified by:
writeToStream
in classRandomAccessOutputStream
- Throws:
java.io.IOException
-
shallowClose
public void shallowClose() throws java.io.IOExceptionDescription copied from class:RandomAccessOutputStream
Closes the RandomAccessInputStream and it's underlying stream- Specified by:
shallowClose
in classRandomAccessOutputStream
- Throws:
java.io.IOException
-