Class Splitter

java.lang.Object
org.kopi.ebics.io.Splitter

public class Splitter extends Object
A mean to split a given input file to 1MB portions. this i useful to handle big file uploading.
Author:
Hachani
  • Constructor Details

    • Splitter

      public Splitter(byte[] input)
      Constructs a new FileSplitter with a given file.
      Parameters:
      input - the input byte array
  • Method Details

    • readInput

      public final void readInput(boolean isCompressionEnabled, SecretKeySpec keySpec) throws EbicsException
      Reads the input stream and splits it to segments of 1MB size.

      EBICS Specification 2.4.2 - 7 Segmentation of the order data:

      The following procedure is to be followed with segmentation:

      1. The order data is ZIP compressed
      2. The compressed order data is encrypted in accordance with Chapter 6.2
      3. The compressed, encrypted order data is base64-coded.
      4. The result is to be verified with regard to the data volume:
        1. If the resulting data volume is below the threshold of 1 MB = 1,048,576 bytes, the order data can be sent complete as a data segment within one transmission step
        2. If the resulting data volume exceeds 1,048,576 bytes the data is to be separated sequentially and in a base64-conformant manner into segments that each have a maximum of 1,048,576 bytes.
      Parameters:
      isCompressionEnabled - enable compression?
      keySpec - the secret key spec
      Throws:
      EbicsException
    • getContent

      public ContentFactory getContent(int segmentNumber)
      Returns the content of a data segment according to a given segment number.
      Parameters:
      segmentNumber - the segment number
      Returns:
      content of a data segment
    • getContent

      public byte[] getContent()
      Returns the hole content.
      Returns:
      the input content.
    • getSegmentNumber

      public int getSegmentNumber()
      Returns the total segment number.
      Returns:
      the total segment number.