Class Splitter
java.lang.Object
org.kopi.ebics.io.Splitter
A mean to split a given input file to
1MB portions. this i useful to handle
big file uploading.
- Author:
- Hachani
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Returns the hole content.getContent(int segmentNumber) Returns the content of a data segment according to a given segment number.intReturns the total segment number.final voidreadInput(boolean isCompressionEnabled, SecretKeySpec keySpec) Reads the input stream and splits it to segments of 1MB size.
-
Constructor Details
-
Splitter
public Splitter(byte[] input) Constructs a newFileSplitterwith 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:
- The order data is ZIP compressed
- The compressed order data is encrypted in accordance with Chapter 6.2
- The compressed, encrypted order data is base64-coded.
- The result is to be verified with regard to the data volume:
- 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
- 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
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.
-