1 /* 2 * Copyright 2013 ZXing authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.google.zxing.pdf417; 18 19 /** 20 * @author Guenther Grau 21 */ 22 public final class PDF417ResultMetadata { 23 24 private int segmentIndex; 25 private String fileId; 26 private boolean lastSegment; 27 private int segmentCount = -1; 28 private String sender; 29 private String addressee; 30 private String fileName; 31 private long fileSize = -1; 32 private long timestamp = -1; 33 private int checksum = -1; 34 private int[] optionalData; 35 36 /** 37 * The Segment ID represents the segment of the whole file distributed over different symbols. 38 * 39 * @return File segment index 40 */ getSegmentIndex()41 public int getSegmentIndex() { 42 return segmentIndex; 43 } 44 setSegmentIndex(int segmentIndex)45 public void setSegmentIndex(int segmentIndex) { 46 this.segmentIndex = segmentIndex; 47 } 48 49 /** 50 * Is the same for each related PDF417 symbol 51 * 52 * @return File ID 53 */ getFileId()54 public String getFileId() { 55 return fileId; 56 } 57 setFileId(String fileId)58 public void setFileId(String fileId) { 59 this.fileId = fileId; 60 } 61 62 /** 63 * @return always null 64 * @deprecated use dedicated already parsed fields 65 */ 66 @Deprecated getOptionalData()67 public int[] getOptionalData() { 68 return optionalData; 69 } 70 71 /** 72 * @param optionalData old optional data format as int array 73 * @deprecated parse and use new fields 74 */ 75 @Deprecated setOptionalData(int[] optionalData)76 public void setOptionalData(int[] optionalData) { 77 this.optionalData = optionalData; 78 } 79 80 81 /** 82 * @return true if it is the last segment 83 */ isLastSegment()84 public boolean isLastSegment() { 85 return lastSegment; 86 } 87 setLastSegment(boolean lastSegment)88 public void setLastSegment(boolean lastSegment) { 89 this.lastSegment = lastSegment; 90 } 91 92 /** 93 * @return count of segments, -1 if not set 94 */ getSegmentCount()95 public int getSegmentCount() { 96 return segmentCount; 97 } 98 setSegmentCount(int segmentCount)99 public void setSegmentCount(int segmentCount) { 100 this.segmentCount = segmentCount; 101 } 102 getSender()103 public String getSender() { 104 return sender; 105 } 106 setSender(String sender)107 public void setSender(String sender) { 108 this.sender = sender; 109 } 110 getAddressee()111 public String getAddressee() { 112 return addressee; 113 } 114 setAddressee(String addressee)115 public void setAddressee(String addressee) { 116 this.addressee = addressee; 117 } 118 119 /** 120 * Filename of the encoded file 121 * 122 * @return filename 123 */ getFileName()124 public String getFileName() { 125 return fileName; 126 } 127 setFileName(String fileName)128 public void setFileName(String fileName) { 129 this.fileName = fileName; 130 } 131 132 /** 133 * filesize in bytes of the encoded file 134 * 135 * @return filesize in bytes, -1 if not set 136 */ getFileSize()137 public long getFileSize() { 138 return fileSize; 139 } 140 setFileSize(long fileSize)141 public void setFileSize(long fileSize) { 142 this.fileSize = fileSize; 143 } 144 145 /** 146 * 16-bit CRC checksum using CCITT-16 147 * 148 * @return crc checksum, -1 if not set 149 */ getChecksum()150 public int getChecksum() { 151 return checksum; 152 } 153 setChecksum(int checksum)154 public void setChecksum(int checksum) { 155 this.checksum = checksum; 156 } 157 158 /** 159 * unix epock timestamp, elapsed seconds since 1970-01-01 160 * 161 * @return elapsed seconds, -1 if not set 162 */ getTimestamp()163 public long getTimestamp() { 164 return timestamp; 165 } 166 setTimestamp(long timestamp)167 public void setTimestamp(long timestamp) { 168 this.timestamp = timestamp; 169 } 170 171 } 172