Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.javaswift.joss.instructions;
 
The Segmentation plan provides a way to access the underlying data as separate InputStreams for the purpose of uploading in several segments.
 
public abstract class SegmentationPlan {
    protected Long segmentationSize;
    protected Long currentSegment = 0L;
    public Long getSegmentNumber() {
        return this.;
    }
    public SegmentationPlan(Long segmentationSize) {
        this. = segmentationSize;
    }
    public InputStream getNextSegment() throws IOException {
        if (done()) {
            return null;
        }
        InputStream segment = createSegment();
        this.++;
        return segment;
    }

    
Checks whether all segments have been done

Returns:
true if the segment can be read
    protected boolean done() {
        return  *  > getFileLength();
    }

    
Returns the file length of the object

Returns:
file length of the object
    protected abstract Long getFileLength();

    
Creates an InputStream from the current segment

Returns:
the inputstream
Throws:
java.io.IOException thrown if error occurs
    protected abstract InputStream createSegment() throws IOException;

    
Closes the underlying File, if appropriate

Throws:
java.io.IOException thrown if error occurs
    public abstract void close() throws IOException;
New to GrepCode? Check out our FAQ X