Class B2UploadProgress


  • public class B2UploadProgress
    extends java.lang.Object
    The B2UploadProgress summarizes the state of an upload. It's a structure so we can extend it later, if needed. NOTE: the length field may sometimes be a little longer than you expect. For example, if we're adding a SHA1 to the thing being uploaded, the contentLength will be at least 40 bytes longer than you expect because we're adding an ascii-hex-encoded SHA1. NOTE: when storing a large file that involves copying parts, it's not possible to reliably compute the startByte for parts that come after a copied part. As a result, these values will be set to the constant UNKNOWN_PART_START_BYTE. Additionally, until copied parts are successfully stored and the B2 API returns the corresponding B2Part, progress events for copied parts will show the length as UNKNOWN_PART_SIZE_PLACEHOLDER. Once a copy succeeds, the progress event for that success will contain the correct length.
    • Field Detail

      • UNKNOWN_PART_SIZE_PLACEHOLDER

        public static final long UNKNOWN_PART_SIZE_PLACEHOLDER
        Placeholder value for part sizes that will not be known until the part is stored in B2. For copy operations, we will not always know the true part size until we receive the B2Part from b2_copy_part. Unless the part being stored is 1 byte, using this value will lead to underestimates on the progress percentage until the part is properly stored.
        See Also:
        Constant Field Values
      • UNKNOWN_PART_START_BYTE

        public static final long UNKNOWN_PART_START_BYTE
        Constant value used to indicate that the starting byte position of the part is unknown. This can happen when storing a large file involves copy operations. Since the sizes of those parts will not be known until they finish copying, parts that come after them will have unknown starting positions in the final file.
        See Also:
        Constant Field Values
    • Constructor Detail

      • B2UploadProgress

        public B2UploadProgress​(int partIndex,
                                int partCount,
                                long startByte,
                                long length,
                                long bytesSoFar,
                                B2UploadState state)
    • Method Detail

      • getPartIndex

        public int getPartIndex()
      • getPartCount

        public int getPartCount()
      • isStartByteKnown

        public boolean isStartByteKnown()
      • getStartByte

        public long getStartByte()
      • getLength

        public long getLength()
      • getBytesSoFar

        public long getBytesSoFar()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object