org.apache.axiom.util.blob.OverflowBlob
from axiom instead@Deprecated
public class TemporaryData
extends java.lang.Object
Data is stored by writing to the output stream obtained using
getOutputStream()
. It can then be read back using
the input stream obtained from getInputStream()
.
The data is first stored into a fixed size buffer. Once this
buffer overflows, it is transferred to a temporary file. The buffer
is divided into a given number of fixed size chunks that are allocated
on demand. Since a temporary file may be created it is mandatory to
call release()
to discard the temporary data.
Constructor and Description |
---|
TemporaryData(int numberOfChunks,
int chunkSize,
java.lang.String tempPrefix,
java.lang.String tempSuffix)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected void |
finalize()
Deprecated.
|
java.io.InputStream |
getInputStream()
Deprecated.
|
long |
getLength()
Deprecated.
|
java.io.OutputStream |
getOutputStream()
Deprecated.
|
void |
readFrom(java.io.InputStream in)
Deprecated.
Fill this object with data read from a given InputStream.
|
void |
release()
Deprecated.
|
void |
writeTo(java.io.OutputStream out)
Deprecated.
Write the data to a given output stream.
|
public TemporaryData(int numberOfChunks, int chunkSize, java.lang.String tempPrefix, java.lang.String tempSuffix)
public java.io.OutputStream getOutputStream()
public void readFrom(java.io.InputStream in) throws java.io.IOException
A call tmp.readFrom(in)
has the same effect as the
following code:
OutputStream out = tmp.getOutputStream(); IOUtils.copy(in, out); out.close();However it does so in a more efficient way.
in
- An InputStream to read data from. This method will not
close the stream.java.io.IOException
- in case of an error in reading from InputStream
public java.io.InputStream getInputStream() throws java.io.IOException
java.io.IOException
public void writeTo(java.io.OutputStream out) throws java.io.IOException
out
- The output stream to write the data to. This method will
not close the stream.java.io.IOException
- in case of an error in writing to the OutputStream
public long getLength()
public void release()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
Copyright © 2005-2020 Apache Software Foundation. All Rights Reserved.