org.tinygroup.weblayer.webcontext.parser.fileupload
类 DeferredByteOutputStream

java.lang.Object
  继承者 java.io.OutputStream
      继承者 org.apache.commons.io.output.ThresholdingOutputStream
          继承者 org.tinygroup.weblayer.webcontext.parser.fileupload.DeferredByteOutputStream
所有已实现的接口:
Closeable, Flushable

public class DeferredByteOutputStream
extends org.apache.commons.io.output.ThresholdingOutputStream

功能说明:对普通字段与表单字段延迟输出

系统版本: v1.0
开发人员: renhui
开发时间: 2014-1-2
功能描述: 写明作用,调用方式,使用场景,以及特殊情况


构造方法摘要
DeferredByteOutputStream(int threshold)
          Constructs an instance of this class which will trigger an event at the specified threshold, and save data to a file beyond that point.
 
方法摘要
 void clearData()
           
 void close()
          Closes underlying output stream, and mark this as closed
 byte[] getFileData()
          返回文件字节流
 byte[] getMemoryData()
          Returns the data for this output stream as an array of bytes, assuming that the data has been retained in memory.
protected  OutputStream getStream()
          Returns the current output stream.
 boolean isInMemory()
          Determines whether or not the data for this output stream has been retained in memory.
protected  void thresholdReached()
          Switches the underlying output stream from a memory based stream to one that is backed by disk.
 void writeTo(OutputStream out)
          Writes the data from this output stream to the specified output stream, after it has been closed.
 
从类 org.apache.commons.io.output.ThresholdingOutputStream 继承的方法
checkThreshold, flush, getByteCount, getThreshold, isThresholdExceeded, resetByteCount, write, write, write
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

DeferredByteOutputStream

public DeferredByteOutputStream(int threshold)
Constructs an instance of this class which will trigger an event at the specified threshold, and save data to a file beyond that point.

参数:
threshold - The number of bytes at which to trigger an event.
outputFile - The file to which data is saved beyond the threshold.
方法详细信息

getStream

protected OutputStream getStream()
                          throws IOException
Returns the current output stream. This may be memory based or disk based, depending on the current state with respect to the threshold.

指定者:
org.apache.commons.io.output.ThresholdingOutputStream 中的 getStream
返回:
The underlying output stream.
抛出:
IOException - if an error occurs.

thresholdReached

protected void thresholdReached()
                         throws IOException
Switches the underlying output stream from a memory based stream to one that is backed by disk. This is the point at which we realise that too much data is being written to keep in memory, so we elect to switch to disk-based storage.

指定者:
org.apache.commons.io.output.ThresholdingOutputStream 中的 thresholdReached
抛出:
IOException - if an error occurs.

isInMemory

public boolean isInMemory()
Determines whether or not the data for this output stream has been retained in memory.

返回:
true if the data is available in memory; false otherwise.

getMemoryData

public byte[] getMemoryData()
Returns the data for this output stream as an array of bytes, assuming that the data has been retained in memory. If the data was written to mongo, this method returns null.

返回:
The data for this output stream, or null if no such data is available.

getFileData

public byte[] getFileData()
返回文件字节流

返回:

close

public void close()
           throws IOException
Closes underlying output stream, and mark this as closed

指定者:
接口 Closeable 中的 close
覆盖:
org.apache.commons.io.output.ThresholdingOutputStream 中的 close
抛出:
IOException - if an error occurs.

writeTo

public void writeTo(OutputStream out)
             throws IOException
Writes the data from this output stream to the specified output stream, after it has been closed.

参数:
out - output stream to write to.
抛出:
IOException - if this stream is not yet closed or an error occurs.

clearData

public void clearData()


Copyright © 2006–2014 开源组织. All rights reserved.