001package co.codewizards.cloudstore.core.dto;
002
003import javax.xml.bind.annotation.XmlRootElement;
004
005@XmlRootElement
006public class FileChunkDto {
007
008        /**
009         * All chunks normally have the same length: 1 MiB. The last chunk, however, might be shorter, hence
010         * there's the {@link #getLength() length} property, too.
011         */
012        public static final int MAX_LENGTH = 1024 * 1024;
013
014        public FileChunkDto() {
015        }
016
017        private long offset;
018
019        private int length;
020
021        private String sha1;
022
023        public long getOffset() {
024                return offset;
025        }
026        public void setOffset(long offset) {
027                this.offset = offset;
028        }
029
030        public int getLength() {
031                return length;
032        }
033        public void setLength(int length) {
034                this.length = length;
035        }
036
037        public String getSha1() {
038                return sha1;
039        }
040        public void setSha1(String sha1) {
041                this.sha1 = sha1;
042        }
043
044        @Override
045        public String toString() {
046                return getClass().getSimpleName() + '[' + toString_getProperties() + ']';
047        }
048
049        protected String toString_getProperties() {
050                return "offset=" + offset
051                                + ", length=" + length
052                                + ", sha1=" + sha1;
053        }
054}