java.lang.Object
org.apache.wicket.request.resource.AbstractResource.WriteCallback
org.apache.wicket.request.resource.PartWriterCallback
Used to read a part of an input stream and writes it to the output stream of the response taken
from attributes in
writeData(org.apache.wicket.request.resource.IResource.Attributes)
method.- Since:
- 7.0.0
- Author:
- Tobias Soloschenko
-
Constructor Summary
ConstructorDescriptionPartWriterCallback
(InputStream inputStream, Long contentLength, Long startbyte, Long endbyte) Creates a part writer callback.
Reads a part of the given input stream. -
Method Summary
Modifier and TypeMethodDescriptionint
Sets the buffer size used to send the data to the clientboolean
isClose()
If the given input stream is going to be closedsetBufferSize
(int bufferSize) Sets the buffer size used to send the data to the clientsetClose
(boolean close) If set true the given input stream is going to be closedvoid
writeData
(IResource.Attributes attributes) Writes the dataMethods inherited from class org.apache.wicket.request.resource.AbstractResource.WriteCallback
writeStream
-
Constructor Details
-
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 Details
-
writeData
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
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
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
If the given input stream is going to be closed- Returns:
- if the given input stream is going to be closed
-
setClose
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
-