com.myJava.file.multivolumes
Class VolumeOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by com.myJava.file.multivolumes.VolumeOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class VolumeOutputStream
extends java.io.OutputStream

Outputstream implementation that slices the output into multiple volumes.

Author:
Olivier PETRUCCI

Areca Build ID : 7299034069467778562

Field Summary
protected  long currentVolumeSize
           
protected  java.io.OutputStream out
           
protected  VolumeStrategy strategy
           
protected  long totalWritten
           
protected  long volumeSize
          Volume Size (bytes)
 
Constructor Summary
VolumeOutputStream(VolumeStrategy strategy, long volumeSize)
           
 
Method Summary
 void close()
           
 void ensureCapacity(long length)
           
 void flush()
           
 VolumeStrategy getStrategy()
           
 long getTotalWritten()
           
 long getWrittenInCurrentVolume()
           
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

strategy

protected VolumeStrategy strategy

out

protected java.io.OutputStream out

currentVolumeSize

protected long currentVolumeSize

totalWritten

protected long totalWritten

volumeSize

protected long volumeSize
Volume Size (bytes)

Constructor Detail

VolumeOutputStream

public VolumeOutputStream(VolumeStrategy strategy,
                          long volumeSize)
Method Detail

getStrategy

public VolumeStrategy getStrategy()

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException

getTotalWritten

public long getTotalWritten()

getWrittenInCurrentVolume

public long getWrittenInCurrentVolume()

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException

write

public void write(byte[] b)
           throws java.io.IOException
Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException

write

public void write(int b)
           throws java.io.IOException
Specified by:
write in class java.io.OutputStream
Throws:
java.io.IOException

ensureCapacity

public void ensureCapacity(long length)
                    throws java.io.IOException
Throws:
java.io.IOException