Class PartWriterCallback

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 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 from
      contentLength - content length of the input stream. Ignored if endByte is specified
      startbyte - 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

      public void writeData(IResource.Attributes attributes) throws IOException
      Writes the data
      Specified by:
      writeData in class AbstractResource.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