Class PartWriterCallback
- java.lang.Object
-
- org.apache.wicket.request.resource.AbstractResource.WriteCallback
-
- org.apache.wicket.request.resource.PartWriterCallback
-
public class PartWriterCallback extends AbstractResource.WriteCallback
Used to read a part of an input stream and writes it to the output stream of the response taken from attributes inwriteData(org.apache.wicket.request.resource.IResource.Attributes)
method.- Since:
- 7.0.0
- Author:
- Tobias Soloschenko
-
-
Constructor Summary
Constructors Constructor Description PartWriterCallback(InputStream inputStream, Long contentLength, Long startbyte, Long endbyte)
Creates a part writer callback.
Reads a part of the given input stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getBufferSize()
Sets the buffer size used to send the data to the clientboolean
isClose()
If the given input stream is going to be closedPartWriterCallback
setBufferSize(int bufferSize)
Sets the buffer size used to send the data to the clientPartWriterCallback
setClose(boolean close)
If set true the given input stream is going to be closedvoid
writeData(IResource.Attributes attributes)
Writes the data-
Methods inherited from class org.apache.wicket.request.resource.AbstractResource.WriteCallback
writeStream
-
-
-
-
Constructor Detail
-
PartWriterCallback
public PartWriterCallback(InputStream inputStream, Long contentLength, Long startbyte, Long endbyte)
Creates a part writer callback.
Reads a part of the given input stream. If the startbyte parameter is not null the number of bytes are skipped till the stream is read. If the endbyte is not null the stream is read till endbyte, else to the end of the whole stream. If startbyte and endbyte is null the whole stream is copied.- Parameters:
inputStream
- the input stream to read fromcontentLength
- content length of the input stream. Ignored if endByte is specifiedstartbyte
- the start position to read from (if not null the number of bytes are skipped till the stream is read)endbyte
- the end position to read to (if not null the stream is going to be read till endbyte, else to the end of the whole stream)
-
-
Method Detail
-
writeData
public void writeData(IResource.Attributes attributes) throws IOException
Writes the data- Specified by:
writeData
in classAbstractResource.WriteCallback
- Parameters:
attributes
- the attributes to get the output stream of the response- Throws:
IOException
- if something went wrong while writing the data to the output stream
-
getBufferSize
public int getBufferSize()
Sets the buffer size used to send the data to the client- Returns:
- the buffer size used to send the data to the client (default is 4096)
-
setBufferSize
public PartWriterCallback setBufferSize(int bufferSize)
Sets the buffer size used to send the data to the client- Parameters:
bufferSize
- the buffer size used to send the data to the client- Returns:
- the part writer callback
-
isClose
public boolean isClose()
If the given input stream is going to be closed- Returns:
- if the given input stream is going to be closed
-
setClose
public PartWriterCallback setClose(boolean close)
If set true the given input stream is going to be closed- Parameters:
close
- if the given input stream is going to be closed- Returns:
- the part writer callback
-
-