mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Boldly move to Java 7 for everything, including Android.
git-svn-id: https://zxing.googlecode.com/svn/trunk@2981 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
1b0c3c7b3a
commit
a53c659b0e
|
@ -19,3 +19,5 @@ application-package=com.google.zxing.client.android
|
||||||
external-libs-folder=libs
|
external-libs-folder=libs
|
||||||
key.store=../private/ZXing.keystore
|
key.store=../private/ZXing.keystore
|
||||||
key.alias=zxing
|
key.alias=zxing
|
||||||
|
java.source=7
|
||||||
|
java.target=7
|
|
@ -55,7 +55,7 @@ final class DecodeHintManager {
|
||||||
* @return name-value pairs
|
* @return name-value pairs
|
||||||
*/
|
*/
|
||||||
private static Map<String,String> splitQuery(String query) {
|
private static Map<String,String> splitQuery(String query) {
|
||||||
Map<String,String> map = new HashMap<String,String>();
|
Map<String,String> map = new HashMap<>();
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
while (pos < query.length()) {
|
while (pos < query.length()) {
|
||||||
if (query.charAt(pos) == '&') {
|
if (query.charAt(pos) == '&') {
|
||||||
|
@ -123,7 +123,7 @@ final class DecodeHintManager {
|
||||||
// Extract parameters
|
// Extract parameters
|
||||||
Map<String, String> parameters = splitQuery(query);
|
Map<String, String> parameters = splitQuery(query);
|
||||||
|
|
||||||
Map<DecodeHintType, Object> hints = new EnumMap<DecodeHintType, Object>(DecodeHintType.class);
|
Map<DecodeHintType, Object> hints = new EnumMap<>(DecodeHintType.class);
|
||||||
|
|
||||||
for (DecodeHintType hintType: DecodeHintType.values()) {
|
for (DecodeHintType hintType: DecodeHintType.values()) {
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ final class DecodeHintManager {
|
||||||
if (extras == null || extras.isEmpty()) {
|
if (extras == null || extras.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Map<DecodeHintType,Object> hints = new EnumMap<DecodeHintType,Object>(DecodeHintType.class);
|
Map<DecodeHintType,Object> hints = new EnumMap<>(DecodeHintType.class);
|
||||||
|
|
||||||
for (DecodeHintType hintType: DecodeHintType.values()) {
|
for (DecodeHintType hintType: DecodeHintType.values()) {
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ final class DecodeThread extends Thread {
|
||||||
this.activity = activity;
|
this.activity = activity;
|
||||||
handlerInitLatch = new CountDownLatch(1);
|
handlerInitLatch = new CountDownLatch(1);
|
||||||
|
|
||||||
hints = new EnumMap<DecodeHintType,Object>(DecodeHintType.class);
|
hints = new EnumMap<>(DecodeHintType.class);
|
||||||
if (baseHints != null) {
|
if (baseHints != null) {
|
||||||
hints.putAll(baseHints);
|
hints.putAll(baseHints);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public final class HttpHelper {
|
||||||
|
|
||||||
private static final String TAG = HttpHelper.class.getSimpleName();
|
private static final String TAG = HttpHelper.class.getSimpleName();
|
||||||
|
|
||||||
private static final Collection<String> REDIRECTOR_DOMAINS = new HashSet<String>(Arrays.asList(
|
private static final Collection<String> REDIRECTOR_DOMAINS = new HashSet<>(Arrays.asList(
|
||||||
"amzn.to", "bit.ly", "bitly.com", "fb.me", "goo.gl", "is.gd", "j.mp", "lnkd.in", "ow.ly",
|
"amzn.to", "bit.ly", "bitly.com", "fb.me", "goo.gl", "is.gd", "j.mp", "lnkd.in", "ow.ly",
|
||||||
"R.BEETAGG.COM", "r.beetagg.com", "SCN.BY", "su.pr", "t.co", "tinyurl.com", "tr.im"
|
"R.BEETAGG.COM", "r.beetagg.com", "SCN.BY", "su.pr", "t.co", "tinyurl.com", "tr.im"
|
||||||
));
|
));
|
||||||
|
@ -102,7 +102,7 @@ public final class HttpHelper {
|
||||||
connection.setRequestProperty("Accept-Charset", "utf-8,*");
|
connection.setRequestProperty("Accept-Charset", "utf-8,*");
|
||||||
connection.setRequestProperty("User-Agent", "ZXing (Android)");
|
connection.setRequestProperty("User-Agent", "ZXing (Android)");
|
||||||
try {
|
try {
|
||||||
int responseCode = safelyConnect(uri, connection);
|
int responseCode = safelyConnect(connection);
|
||||||
switch (responseCode) {
|
switch (responseCode) {
|
||||||
case HttpURLConnection.HTTP_OK:
|
case HttpURLConnection.HTTP_OK:
|
||||||
return consume(connection, maxChars);
|
return consume(connection, maxChars);
|
||||||
|
@ -150,10 +150,8 @@ public final class HttpHelper {
|
||||||
if (in != null) {
|
if (in != null) {
|
||||||
try {
|
try {
|
||||||
in.close();
|
in.close();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException | NullPointerException ioe) {
|
||||||
// continue
|
// continue
|
||||||
} catch (NullPointerException npe) {
|
|
||||||
// another apparent Android / Harmony bug; continue
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,7 +169,7 @@ public final class HttpHelper {
|
||||||
connection.setRequestMethod("HEAD");
|
connection.setRequestMethod("HEAD");
|
||||||
connection.setRequestProperty("User-Agent", "ZXing (Android)");
|
connection.setRequestProperty("User-Agent", "ZXing (Android)");
|
||||||
try {
|
try {
|
||||||
int responseCode = safelyConnect(uri.toString(), connection);
|
int responseCode = safelyConnect(connection);
|
||||||
switch (responseCode) {
|
switch (responseCode) {
|
||||||
case HttpURLConnection.HTTP_MULT_CHOICE:
|
case HttpURLConnection.HTTP_MULT_CHOICE:
|
||||||
case HttpURLConnection.HTTP_MOVED_PERM:
|
case HttpURLConnection.HTTP_MOVED_PERM:
|
||||||
|
@ -208,35 +206,18 @@ public final class HttpHelper {
|
||||||
return (HttpURLConnection) conn;
|
return (HttpURLConnection) conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int safelyConnect(String uri, HttpURLConnection connection) throws IOException {
|
private static int safelyConnect(HttpURLConnection connection) throws IOException {
|
||||||
try {
|
try {
|
||||||
connection.connect();
|
connection.connect();
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException | IllegalArgumentException | IndexOutOfBoundsException | SecurityException e) {
|
||||||
// this is an Android bug: http://code.google.com/p/android/issues/detail?id=16895
|
// this is an Android bug: http://code.google.com/p/android/issues/detail?id=16895
|
||||||
throw new IOException(npe);
|
throw new IOException(e);
|
||||||
} catch (IllegalArgumentException iae) {
|
|
||||||
// Also seen this in the wild, not sure what to make of it. Probably a bad URL
|
|
||||||
throw new IOException(iae);
|
|
||||||
} catch (SecurityException se) {
|
|
||||||
// due to bad VPN settings?
|
|
||||||
Log.w(TAG, "Restricted URI? " + uri);
|
|
||||||
throw new IOException(se);
|
|
||||||
} catch (IndexOutOfBoundsException ioobe) {
|
|
||||||
// Another Android problem? https://groups.google.com/forum/?fromgroups#!topic/google-admob-ads-sdk/U-WfmYa9or0
|
|
||||||
throw new IOException(ioobe);
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return connection.getResponseCode();
|
return connection.getResponseCode();
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException | StringIndexOutOfBoundsException | IllegalArgumentException e) {
|
||||||
// this is maybe this Android bug: http://code.google.com/p/android/issues/detail?id=15554
|
// this is maybe this Android bug: http://code.google.com/p/android/issues/detail?id=15554
|
||||||
throw new IOException(npe);
|
throw new IOException(e);
|
||||||
} catch (IllegalArgumentException iae) {
|
|
||||||
// Again seen this in the wild for bad header fields in the server response! or bad reads
|
|
||||||
Log.w(TAG, "Bad server status? " + uri);
|
|
||||||
throw new IOException(iae);
|
|
||||||
} catch (StringIndexOutOfBoundsException sioobe) {
|
|
||||||
// Another Android bug: https://code.google.com/p/android/issues/detail?id=18856
|
|
||||||
throw new IOException(sioobe);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ public final class LocaleManager {
|
||||||
*/
|
*/
|
||||||
private static final Map<String,String> GOOGLE_COUNTRY_TLD;
|
private static final Map<String,String> GOOGLE_COUNTRY_TLD;
|
||||||
static {
|
static {
|
||||||
GOOGLE_COUNTRY_TLD = new HashMap<String,String>();
|
GOOGLE_COUNTRY_TLD = new HashMap<>();
|
||||||
GOOGLE_COUNTRY_TLD.put("AR", "com.ar"); // ARGENTINA
|
GOOGLE_COUNTRY_TLD.put("AR", "com.ar"); // ARGENTINA
|
||||||
GOOGLE_COUNTRY_TLD.put("AU", "com.au"); // AUSTRALIA
|
GOOGLE_COUNTRY_TLD.put("AU", "com.au"); // AUSTRALIA
|
||||||
GOOGLE_COUNTRY_TLD.put("BR", "com.br"); // BRAZIL
|
GOOGLE_COUNTRY_TLD.put("BR", "com.br"); // BRAZIL
|
||||||
|
@ -84,7 +84,7 @@ public final class LocaleManager {
|
||||||
*/
|
*/
|
||||||
private static final Map<String,String> GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD;
|
private static final Map<String,String> GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD;
|
||||||
static {
|
static {
|
||||||
GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD = new HashMap<String,String>();
|
GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD = new HashMap<>();
|
||||||
GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put("AU", "com.au"); // AUSTRALIA
|
GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put("AU", "com.au"); // AUSTRALIA
|
||||||
//GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.CHINA.getCountry(), "cn");
|
//GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.CHINA.getCountry(), "cn");
|
||||||
GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.FRANCE.getCountry(), "fr");
|
GOOGLE_PRODUCT_SEARCH_COUNTRY_TLD.put(Locale.FRANCE.getCountry(), "fr");
|
||||||
|
|
|
@ -52,7 +52,7 @@ public final class PreferencesFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disableLastCheckedPref() {
|
private void disableLastCheckedPref() {
|
||||||
Collection<CheckBoxPreference> checked = new ArrayList<CheckBoxPreference>(3);
|
Collection<CheckBoxPreference> checked = new ArrayList<>(3);
|
||||||
if (decode1D.isChecked()) {
|
if (decode1D.isChecked()) {
|
||||||
checked.add(decode1D);
|
checked.add(decode1D);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ public final class ViewfinderView extends View {
|
||||||
laserColor = resources.getColor(R.color.viewfinder_laser);
|
laserColor = resources.getColor(R.color.viewfinder_laser);
|
||||||
resultPointColor = resources.getColor(R.color.possible_result_points);
|
resultPointColor = resources.getColor(R.color.possible_result_points);
|
||||||
scannerAlpha = 0;
|
scannerAlpha = 0;
|
||||||
possibleResultPoints = new ArrayList<ResultPoint>(5);
|
possibleResultPoints = new ArrayList<>(5);
|
||||||
lastPossibleResultPoints = null;
|
lastPossibleResultPoints = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ public final class ViewfinderView extends View {
|
||||||
if (currentPossible.isEmpty()) {
|
if (currentPossible.isEmpty()) {
|
||||||
lastPossibleResultPoints = null;
|
lastPossibleResultPoints = null;
|
||||||
} else {
|
} else {
|
||||||
possibleResultPoints = new ArrayList<ResultPoint>(5);
|
possibleResultPoints = new ArrayList<>(5);
|
||||||
lastPossibleResultPoints = currentPossible;
|
lastPossibleResultPoints = currentPossible;
|
||||||
paint.setAlpha(CURRENT_POINT_OPACITY);
|
paint.setAlpha(CURRENT_POINT_OPACITY);
|
||||||
paint.setColor(resultPointColor);
|
paint.setColor(resultPointColor);
|
||||||
|
|
|
@ -212,7 +212,7 @@ public final class SearchBookContentsActivity extends Activity {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
JSONArray results = json.getJSONArray("search_results");
|
JSONArray results = json.getJSONArray("search_results");
|
||||||
SearchBookContentsResult.setQuery(queryTextView.getText().toString());
|
SearchBookContentsResult.setQuery(queryTextView.getText().toString());
|
||||||
List<SearchBookContentsResult> items = new ArrayList<SearchBookContentsResult>(count);
|
List<SearchBookContentsResult> items = new ArrayList<>(count);
|
||||||
for (int x = 0; x < count; x++) {
|
for (int x = 0; x < count; x++) {
|
||||||
items.add(parseResult(results.getJSONObject(x)));
|
items.add(parseResult(results.getJSONObject(x)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ final class AutoFocusManager implements Camera.AutoFocusCallback {
|
||||||
private static final long AUTO_FOCUS_INTERVAL_MS = 2000L;
|
private static final long AUTO_FOCUS_INTERVAL_MS = 2000L;
|
||||||
private static final Collection<String> FOCUS_MODES_CALLING_AF;
|
private static final Collection<String> FOCUS_MODES_CALLING_AF;
|
||||||
static {
|
static {
|
||||||
FOCUS_MODES_CALLING_AF = new ArrayList<String>(2);
|
FOCUS_MODES_CALLING_AF = new ArrayList<>(2);
|
||||||
FOCUS_MODES_CALLING_AF.add(Camera.Parameters.FOCUS_MODE_AUTO);
|
FOCUS_MODES_CALLING_AF.add(Camera.Parameters.FOCUS_MODE_AUTO);
|
||||||
FOCUS_MODES_CALLING_AF.add(Camera.Parameters.FOCUS_MODE_MACRO);
|
FOCUS_MODES_CALLING_AF.add(Camera.Parameters.FOCUS_MODE_MACRO);
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,7 +216,7 @@ final class CameraConfigurationManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort by size, descending
|
// Sort by size, descending
|
||||||
List<Camera.Size> supportedPreviewSizes = new ArrayList<Camera.Size>(rawSupportedSizes);
|
List<Camera.Size> supportedPreviewSizes = new ArrayList<>(rawSupportedSizes);
|
||||||
Collections.sort(supportedPreviewSizes, new Comparator<Camera.Size>() {
|
Collections.sort(supportedPreviewSizes, new Comparator<Camera.Size>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(Camera.Size a, Camera.Size b) {
|
public int compare(Camera.Size a, Camera.Size b) {
|
||||||
|
|
|
@ -38,12 +38,9 @@ public final class ClipboardInterface {
|
||||||
if (text != null) {
|
if (text != null) {
|
||||||
try {
|
try {
|
||||||
getManager(context).setPrimaryClip(ClipData.newPlainText(null, text));
|
getManager(context).setPrimaryClip(ClipData.newPlainText(null, text));
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException | IllegalStateException e) {
|
||||||
// Have seen this in the wild, bizarrely
|
// Have seen this in the wild, bizarrely
|
||||||
Log.w(TAG, "Clipboard bug", npe);
|
Log.w(TAG, "Clipboard bug", e);
|
||||||
} catch (IllegalStateException ise) {
|
|
||||||
// java.lang.IllegalStateException: beginBroadcast() called while already in a broadcast
|
|
||||||
Log.w(TAG, "Clipboard bug", ise);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ abstract class ContactEncoder {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int count = 0;
|
int count = 0;
|
||||||
Collection<String> uniques = new HashSet<String>(2);
|
Collection<String> uniques = new HashSet<>(2);
|
||||||
for (String value : values) {
|
for (String value : values) {
|
||||||
String trimmed = trim(value);
|
String trimmed = trim(value);
|
||||||
if (trimmed != null && !trimmed.isEmpty() && !uniques.contains(trimmed)) {
|
if (trimmed != null && !trimmed.isEmpty() && !uniques.contains(trimmed)) {
|
||||||
|
|
|
@ -214,35 +214,44 @@ final class QRCodeEncoder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void encodeQRCodeContents(Intent intent, String type) {
|
private void encodeQRCodeContents(Intent intent, String type) {
|
||||||
if (type.equals(Contents.Type.TEXT)) {
|
switch (type) {
|
||||||
|
case Contents.Type.TEXT: {
|
||||||
String data = intent.getStringExtra(Intents.Encode.DATA);
|
String data = intent.getStringExtra(Intents.Encode.DATA);
|
||||||
if (data != null && !data.isEmpty()) {
|
if (data != null && !data.isEmpty()) {
|
||||||
contents = data;
|
contents = data;
|
||||||
displayContents = data;
|
displayContents = data;
|
||||||
title = activity.getString(R.string.contents_text);
|
title = activity.getString(R.string.contents_text);
|
||||||
}
|
}
|
||||||
} else if (type.equals(Contents.Type.EMAIL)) {
|
break;
|
||||||
|
}
|
||||||
|
case Contents.Type.EMAIL: {
|
||||||
String data = ContactEncoder.trim(intent.getStringExtra(Intents.Encode.DATA));
|
String data = ContactEncoder.trim(intent.getStringExtra(Intents.Encode.DATA));
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
contents = "mailto:" + data;
|
contents = "mailto:" + data;
|
||||||
displayContents = data;
|
displayContents = data;
|
||||||
title = activity.getString(R.string.contents_email);
|
title = activity.getString(R.string.contents_email);
|
||||||
}
|
}
|
||||||
} else if (type.equals(Contents.Type.PHONE)) {
|
break;
|
||||||
|
}
|
||||||
|
case Contents.Type.PHONE: {
|
||||||
String data = ContactEncoder.trim(intent.getStringExtra(Intents.Encode.DATA));
|
String data = ContactEncoder.trim(intent.getStringExtra(Intents.Encode.DATA));
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
contents = "tel:" + data;
|
contents = "tel:" + data;
|
||||||
displayContents = PhoneNumberUtils.formatNumber(data);
|
displayContents = PhoneNumberUtils.formatNumber(data);
|
||||||
title = activity.getString(R.string.contents_phone);
|
title = activity.getString(R.string.contents_phone);
|
||||||
}
|
}
|
||||||
} else if (type.equals(Contents.Type.SMS)) {
|
break;
|
||||||
|
}
|
||||||
|
case Contents.Type.SMS: {
|
||||||
String data = ContactEncoder.trim(intent.getStringExtra(Intents.Encode.DATA));
|
String data = ContactEncoder.trim(intent.getStringExtra(Intents.Encode.DATA));
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
contents = "sms:" + data;
|
contents = "sms:" + data;
|
||||||
displayContents = PhoneNumberUtils.formatNumber(data);
|
displayContents = PhoneNumberUtils.formatNumber(data);
|
||||||
title = activity.getString(R.string.contents_sms);
|
title = activity.getString(R.string.contents_sms);
|
||||||
}
|
}
|
||||||
} else if (type.equals(Contents.Type.CONTACT)) {
|
break;
|
||||||
|
}
|
||||||
|
case Contents.Type.CONTACT: {
|
||||||
|
|
||||||
Bundle bundle = intent.getBundleExtra(Intents.Encode.DATA);
|
Bundle bundle = intent.getBundleExtra(Intents.Encode.DATA);
|
||||||
if (bundle != null) {
|
if (bundle != null) {
|
||||||
|
@ -250,11 +259,11 @@ final class QRCodeEncoder {
|
||||||
String name = bundle.getString(ContactsContract.Intents.Insert.NAME);
|
String name = bundle.getString(ContactsContract.Intents.Insert.NAME);
|
||||||
String organization = bundle.getString(ContactsContract.Intents.Insert.COMPANY);
|
String organization = bundle.getString(ContactsContract.Intents.Insert.COMPANY);
|
||||||
String address = bundle.getString(ContactsContract.Intents.Insert.POSTAL);
|
String address = bundle.getString(ContactsContract.Intents.Insert.POSTAL);
|
||||||
Collection<String> phones = new ArrayList<String>(Contents.PHONE_KEYS.length);
|
Collection<String> phones = new ArrayList<>(Contents.PHONE_KEYS.length);
|
||||||
for (int x = 0; x < Contents.PHONE_KEYS.length; x++) {
|
for (int x = 0; x < Contents.PHONE_KEYS.length; x++) {
|
||||||
phones.add(bundle.getString(Contents.PHONE_KEYS[x]));
|
phones.add(bundle.getString(Contents.PHONE_KEYS[x]));
|
||||||
}
|
}
|
||||||
Collection<String> emails = new ArrayList<String>(Contents.EMAIL_KEYS.length);
|
Collection<String> emails = new ArrayList<>(Contents.EMAIL_KEYS.length);
|
||||||
for (int x = 0; x < Contents.EMAIL_KEYS.length; x++) {
|
for (int x = 0; x < Contents.EMAIL_KEYS.length; x++) {
|
||||||
emails.add(bundle.getString(Contents.EMAIL_KEYS[x]));
|
emails.add(bundle.getString(Contents.EMAIL_KEYS[x]));
|
||||||
}
|
}
|
||||||
|
@ -279,7 +288,9 @@ final class QRCodeEncoder {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (type.equals(Contents.Type.LOCATION)) {
|
break;
|
||||||
|
}
|
||||||
|
case Contents.Type.LOCATION: {
|
||||||
Bundle bundle = intent.getBundleExtra(Intents.Encode.DATA);
|
Bundle bundle = intent.getBundleExtra(Intents.Encode.DATA);
|
||||||
if (bundle != null) {
|
if (bundle != null) {
|
||||||
// These must use Bundle.getFloat(), not getDouble(), it's part of the API.
|
// These must use Bundle.getFloat(), not getDouble(), it's part of the API.
|
||||||
|
@ -291,6 +302,8 @@ final class QRCodeEncoder {
|
||||||
title = activity.getString(R.string.contents_location);
|
title = activity.getString(R.string.contents_location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,7 +336,7 @@ final class QRCodeEncoder {
|
||||||
Map<EncodeHintType,Object> hints = null;
|
Map<EncodeHintType,Object> hints = null;
|
||||||
String encoding = guessAppropriateEncoding(contentsToEncode);
|
String encoding = guessAppropriateEncoding(contentsToEncode);
|
||||||
if (encoding != null) {
|
if (encoding != null) {
|
||||||
hints = new EnumMap<EncodeHintType,Object>(EncodeHintType.class);
|
hints = new EnumMap<>(EncodeHintType.class);
|
||||||
hints.put(EncodeHintType.CHARACTER_SET, encoding);
|
hints.put(EncodeHintType.CHARACTER_SET, encoding);
|
||||||
}
|
}
|
||||||
BitMatrix result;
|
BitMatrix result;
|
||||||
|
|
|
@ -92,7 +92,7 @@ public final class HistoryManager {
|
||||||
|
|
||||||
public List<HistoryItem> buildHistoryItems() {
|
public List<HistoryItem> buildHistoryItems() {
|
||||||
SQLiteOpenHelper helper = new DBHelper(activity);
|
SQLiteOpenHelper helper = new DBHelper(activity);
|
||||||
List<HistoryItem> items = new ArrayList<HistoryItem>();
|
List<HistoryItem> items = new ArrayList<>();
|
||||||
SQLiteDatabase db = null;
|
SQLiteDatabase db = null;
|
||||||
Cursor cursor = null;
|
Cursor cursor = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -71,7 +71,7 @@ final class AmazonInfoRetriever extends SupplementalInfoRetriever {
|
||||||
HttpHelper.ContentType.XML);
|
HttpHelper.ContentType.XML);
|
||||||
|
|
||||||
String detailPageURL = null;
|
String detailPageURL = null;
|
||||||
Collection<String> authors = new ArrayList<String>();
|
Collection<String> authors = new ArrayList<>();
|
||||||
String title = null;
|
String title = null;
|
||||||
String formattedNewPrice = null;
|
String formattedNewPrice = null;
|
||||||
String formattedUsedPrice = null;
|
String formattedUsedPrice = null;
|
||||||
|
@ -84,31 +84,41 @@ final class AmazonInfoRetriever extends SupplementalInfoRetriever {
|
||||||
boolean seenLowestNewPrice = false;
|
boolean seenLowestNewPrice = false;
|
||||||
boolean seenLowestUsedPrice = false;
|
boolean seenLowestUsedPrice = false;
|
||||||
|
|
||||||
for (int eventType = xpp.getEventType(); eventType != XmlPullParser.END_DOCUMENT; eventType = xpp.next()) {
|
boolean done = false;
|
||||||
|
for (int eventType = xpp.getEventType();
|
||||||
|
!done && eventType != XmlPullParser.END_DOCUMENT;
|
||||||
|
eventType = xpp.next()) {
|
||||||
if (eventType == XmlPullParser.START_TAG) {
|
if (eventType == XmlPullParser.START_TAG) {
|
||||||
String name = xpp.getName();
|
String name = xpp.getName();
|
||||||
if ("Item".equals(name)) {
|
switch (name) {
|
||||||
|
case "Item":
|
||||||
if (seenItem) {
|
if (seenItem) {
|
||||||
break;
|
done = true; // terminates loop
|
||||||
} else {
|
} else {
|
||||||
seenItem = true;
|
seenItem = true;
|
||||||
}
|
}
|
||||||
} else if ("DetailPageURL".equals(name)) {
|
break;
|
||||||
|
case "DetailPageURL":
|
||||||
assertTextNext(xpp);
|
assertTextNext(xpp);
|
||||||
detailPageURL = xpp.getText();
|
detailPageURL = xpp.getText();
|
||||||
} else if ("Author".equals(name)) {
|
break;
|
||||||
|
case "Author":
|
||||||
assertTextNext(xpp);
|
assertTextNext(xpp);
|
||||||
authors.add(xpp.getText());
|
authors.add(xpp.getText());
|
||||||
} else if ("Title".equals(name)) {
|
break;
|
||||||
|
case "Title":
|
||||||
assertTextNext(xpp);
|
assertTextNext(xpp);
|
||||||
title = xpp.getText();
|
title = xpp.getText();
|
||||||
} else if ("LowestNewPrice".equals(name)) {
|
break;
|
||||||
|
case "LowestNewPrice":
|
||||||
seenLowestNewPrice = true;
|
seenLowestNewPrice = true;
|
||||||
seenLowestUsedPrice = false;
|
seenLowestUsedPrice = false;
|
||||||
} else if ("LowestUsedPrice".equals(name)) {
|
break;
|
||||||
|
case "LowestUsedPrice":
|
||||||
seenLowestNewPrice = false;
|
seenLowestNewPrice = false;
|
||||||
seenLowestUsedPrice = true;
|
seenLowestUsedPrice = true;
|
||||||
} else if ("FormattedPrice".equals(name)) {
|
break;
|
||||||
|
case "FormattedPrice":
|
||||||
if (seenLowestNewPrice || seenLowestUsedPrice) {
|
if (seenLowestNewPrice || seenLowestUsedPrice) {
|
||||||
assertTextNext(xpp);
|
assertTextNext(xpp);
|
||||||
String theText = xpp.getText();
|
String theText = xpp.getText();
|
||||||
|
@ -120,8 +130,10 @@ final class AmazonInfoRetriever extends SupplementalInfoRetriever {
|
||||||
seenLowestNewPrice = false;
|
seenLowestNewPrice = false;
|
||||||
seenLowestUsedPrice = false;
|
seenLowestUsedPrice = false;
|
||||||
}
|
}
|
||||||
} else if ("Errors".equals(name)) {
|
break;
|
||||||
|
case "Errors":
|
||||||
error = true;
|
error = true;
|
||||||
|
done = true; // terminates loop
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,7 +147,7 @@ final class AmazonInfoRetriever extends SupplementalInfoRetriever {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Collection<String> newTexts = new ArrayList<String>();
|
Collection<String> newTexts = new ArrayList<>();
|
||||||
maybeAddText(title, newTexts);
|
maybeAddText(title, newTexts);
|
||||||
maybeAddTextSeries(authors, newTexts);
|
maybeAddTextSeries(authors, newTexts);
|
||||||
if (formattedNewPrice != null) {
|
if (formattedNewPrice != null) {
|
||||||
|
|
|
@ -81,7 +81,7 @@ final class BookResultInfoRetriever extends SupplementalInfoRetriever {
|
||||||
|
|
||||||
JSONArray authorsArray = volumeInfo.optJSONArray("authors");
|
JSONArray authorsArray = volumeInfo.optJSONArray("authors");
|
||||||
if (authorsArray != null && !authorsArray.isNull(0)) {
|
if (authorsArray != null && !authorsArray.isNull(0)) {
|
||||||
authors = new ArrayList<String>(authorsArray.length());
|
authors = new ArrayList<>(authorsArray.length());
|
||||||
for (int i = 0; i < authorsArray.length(); i++) {
|
for (int i = 0; i < authorsArray.length(); i++) {
|
||||||
authors.add(authorsArray.getString(i));
|
authors.add(authorsArray.getString(i));
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ final class BookResultInfoRetriever extends SupplementalInfoRetriever {
|
||||||
throw new IOException(e);
|
throw new IOException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Collection<String> newTexts = new ArrayList<String>();
|
Collection<String> newTexts = new ArrayList<>();
|
||||||
maybeAddText(title, newTexts);
|
maybeAddText(title, newTexts);
|
||||||
maybeAddTextSeries(authors, newTexts);
|
maybeAddTextSeries(authors, newTexts);
|
||||||
maybeAddText(pages == null || pages.isEmpty() ? null : pages + "pp.", newTexts);
|
maybeAddText(pages == null || pages.isEmpty() ? null : pages + "pp.", newTexts);
|
||||||
|
|
|
@ -91,10 +91,10 @@ public abstract class SupplementalInfoRetriever extends AsyncTask<Object,Object,
|
||||||
private final Collection<String[]> newHistories;
|
private final Collection<String[]> newHistories;
|
||||||
|
|
||||||
SupplementalInfoRetriever(TextView textView, HistoryManager historyManager) {
|
SupplementalInfoRetriever(TextView textView, HistoryManager historyManager) {
|
||||||
textViewRef = new WeakReference<TextView>(textView);
|
textViewRef = new WeakReference<>(textView);
|
||||||
historyManagerRef = new WeakReference<HistoryManager>(historyManager);
|
historyManagerRef = new WeakReference<>(historyManager);
|
||||||
newContents = new ArrayList<Spannable>();
|
newContents = new ArrayList<>();
|
||||||
newHistories = new ArrayList<String[]>();
|
newHistories = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -58,7 +58,7 @@ final class LoadPackagesAsyncTask extends AsyncTask<Void,Void,List<AppInfo>> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<AppInfo> doInBackground(Void... objects) {
|
protected List<AppInfo> doInBackground(Void... objects) {
|
||||||
List<AppInfo> labelsPackages = new ArrayList<AppInfo>();
|
List<AppInfo> labelsPackages = new ArrayList<>();
|
||||||
PackageManager packageManager = activity.getPackageManager();
|
PackageManager packageManager = activity.getPackageManager();
|
||||||
Iterable<ApplicationInfo> appInfos = packageManager.getInstalledApplications(0);
|
Iterable<ApplicationInfo> appInfos = packageManager.getInstalledApplications(0);
|
||||||
for (PackageItemInfo appInfo : appInfos) {
|
for (PackageItemInfo appInfo : appInfos) {
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
-->
|
-->
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.google.zxing.client.androidtest"
|
package="com.google.zxing.client.androidtest"
|
||||||
android:versionName="1.4"
|
android:versionName="1.4.1"
|
||||||
android:versionCode="9"
|
android:versionCode="10"
|
||||||
android:installLocation="auto">
|
android:installLocation="auto">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.CAMERA"/>
|
<uses-permission android:name="android.permission.CAMERA"/>
|
||||||
|
|
|
@ -19,3 +19,5 @@ application-package=com.google.zxing.client.androidtest
|
||||||
external-libs-folder=libs
|
external-libs-folder=libs
|
||||||
key.store=../private/ZXing.keystore
|
key.store=../private/ZXing.keystore
|
||||||
key.alias=zxing
|
key.alias=zxing
|
||||||
|
java.source=7
|
||||||
|
java.target=7
|
|
@ -53,7 +53,7 @@ public final class BenchmarkAsyncTask extends AsyncTask<Object,Object,String> {
|
||||||
// Try to get in a known state before starting the benchmark
|
// Try to get in a known state before starting the benchmark
|
||||||
System.gc();
|
System.gc();
|
||||||
|
|
||||||
List<BenchmarkItem> items = new ArrayList<BenchmarkItem>();
|
List<BenchmarkItem> items = new ArrayList<>();
|
||||||
walkTree(reader, path, items);
|
walkTree(reader, path, items);
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
|
@ -99,7 +99,7 @@ public final class MultiFormatReader implements Reader {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Collection<BarcodeFormat> formats =
|
Collection<BarcodeFormat> formats =
|
||||||
hints == null ? null : (Collection<BarcodeFormat>) hints.get(DecodeHintType.POSSIBLE_FORMATS);
|
hints == null ? null : (Collection<BarcodeFormat>) hints.get(DecodeHintType.POSSIBLE_FORMATS);
|
||||||
Collection<Reader> readers = new ArrayList<Reader>();
|
Collection<Reader> readers = new ArrayList<>();
|
||||||
if (formats != null) {
|
if (formats != null) {
|
||||||
boolean addOneDReader =
|
boolean addOneDReader =
|
||||||
formats.contains(BarcodeFormat.UPC_A) ||
|
formats.contains(BarcodeFormat.UPC_A) ||
|
||||||
|
|
|
@ -94,7 +94,7 @@ public final class Result {
|
||||||
|
|
||||||
public void putMetadata(ResultMetadataType type, Object value) {
|
public void putMetadata(ResultMetadataType type, Object value) {
|
||||||
if (resultMetadata == null) {
|
if (resultMetadata == null) {
|
||||||
resultMetadata = new EnumMap<ResultMetadataType,Object>(ResultMetadataType.class);
|
resultMetadata = new EnumMap<>(ResultMetadataType.class);
|
||||||
}
|
}
|
||||||
resultMetadata.put(type, value);
|
resultMetadata.put(type, value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,16 +75,7 @@ public final class AztecReader implements Reader {
|
||||||
AztecDetectorResult detectorResult = detector.detect(true);
|
AztecDetectorResult detectorResult = detector.detect(true);
|
||||||
points = detectorResult.getPoints();
|
points = detectorResult.getPoints();
|
||||||
decoderResult = new Decoder().decode(detectorResult);
|
decoderResult = new Decoder().decode(detectorResult);
|
||||||
} catch (NotFoundException e) {
|
} catch (NotFoundException | FormatException e) {
|
||||||
if (notFoundException != null) {
|
|
||||||
throw notFoundException;
|
|
||||||
}
|
|
||||||
if (formatException != null) {
|
|
||||||
throw formatException;
|
|
||||||
}
|
|
||||||
throw e;
|
|
||||||
} catch (FormatException e) {
|
|
||||||
// throw the exception from the non-mirror case, instead
|
|
||||||
if (notFoundException != null) {
|
if (notFoundException != null) {
|
||||||
throw notFoundException;
|
throw notFoundException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,7 +203,7 @@ public final class HighLevelEncoder {
|
||||||
// for the new character, merging the results, and then removing the
|
// for the new character, merging the results, and then removing the
|
||||||
// non-optimal states.
|
// non-optimal states.
|
||||||
private Collection<State> updateStateListForChar(Iterable<State> states, int index) {
|
private Collection<State> updateStateListForChar(Iterable<State> states, int index) {
|
||||||
Collection<State> result = new LinkedList<State>();
|
Collection<State> result = new LinkedList<>();
|
||||||
for (State state : states) {
|
for (State state : states) {
|
||||||
updateStateForChar(state, index, result);
|
updateStateForChar(state, index, result);
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ public final class HighLevelEncoder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Collection<State> updateStateListForPair(Iterable<State> states, int index, int pairCode) {
|
private static Collection<State> updateStateListForPair(Iterable<State> states, int index, int pairCode) {
|
||||||
Collection<State> result = new LinkedList<State>();
|
Collection<State> result = new LinkedList<>();
|
||||||
for (State state : states) {
|
for (State state : states) {
|
||||||
updateStateForPair(state, index, pairCode, result);
|
updateStateForPair(state, index, pairCode, result);
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ public final class HighLevelEncoder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Collection<State> simplifyStates(Iterable<State> states) {
|
private static Collection<State> simplifyStates(Iterable<State> states) {
|
||||||
List<State> result = new LinkedList<State>();
|
List<State> result = new LinkedList<>();
|
||||||
for (State newState : states) {
|
for (State newState : states) {
|
||||||
boolean add = true;
|
boolean add = true;
|
||||||
for (Iterator<State> iterator = result.iterator(); iterator.hasNext(); ) {
|
for (Iterator<State> iterator = result.iterator(); iterator.hasNext(); ) {
|
||||||
|
|
|
@ -148,7 +148,7 @@ final class State {
|
||||||
BitArray toBitArray(byte[] text) {
|
BitArray toBitArray(byte[] text) {
|
||||||
// Reverse the tokens, so that they are in the order that they should
|
// Reverse the tokens, so that they are in the order that they should
|
||||||
// be output
|
// be output
|
||||||
Deque<Token> symbols = new LinkedList<Token>();
|
Deque<Token> symbols = new LinkedList<>();
|
||||||
for (Token token = endBinaryShift(text.length).token; token != null; token = token.getPrevious()) {
|
for (Token token = endBinaryShift(text.length).token; token != null; token = token.getPrevious()) {
|
||||||
symbols.addFirst(token);
|
symbols.addFirst(token);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ public final class AddressBookAUResultParser extends ResultParser {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (values == null) {
|
if (values == null) {
|
||||||
values = new ArrayList<String>(max); // lazy init
|
values = new ArrayList<>(max); // lazy init
|
||||||
}
|
}
|
||||||
values.add(value);
|
values.add(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ public final class BizcardResultParser extends AbstractDoCoMoResultParser {
|
||||||
private static String[] buildPhoneNumbers(String number1,
|
private static String[] buildPhoneNumbers(String number1,
|
||||||
String number2,
|
String number2,
|
||||||
String number3) {
|
String number3) {
|
||||||
List<String> numbers = new ArrayList<String>(3);
|
List<String> numbers = new ArrayList<>(3);
|
||||||
if (number1 != null) {
|
if (number1 != null) {
|
||||||
numbers.add(number1);
|
numbers.add(number1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ public final class ExpandedProductResultParser extends ResultParser {
|
||||||
String price = null;
|
String price = null;
|
||||||
String priceIncrement = null;
|
String priceIncrement = null;
|
||||||
String priceCurrency = null;
|
String priceCurrency = null;
|
||||||
Map<String,String> uncommonAIs = new HashMap<String,String>();
|
Map<String,String> uncommonAIs = new HashMap<>();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
@ -77,42 +77,67 @@ public final class ExpandedProductResultParser extends ResultParser {
|
||||||
String value = findValue(i, rawText);
|
String value = findValue(i, rawText);
|
||||||
i += value.length();
|
i += value.length();
|
||||||
|
|
||||||
if ("00".equals(ai)) {
|
switch (ai) {
|
||||||
|
case "00":
|
||||||
sscc = value;
|
sscc = value;
|
||||||
} else if ("01".equals(ai)) {
|
break;
|
||||||
|
case "01":
|
||||||
productID = value;
|
productID = value;
|
||||||
} else if ("10".equals(ai)) {
|
break;
|
||||||
|
case "10":
|
||||||
lotNumber = value;
|
lotNumber = value;
|
||||||
} else if ("11".equals(ai)) {
|
break;
|
||||||
|
case "11":
|
||||||
productionDate = value;
|
productionDate = value;
|
||||||
} else if ("13".equals(ai)) {
|
break;
|
||||||
|
case "13":
|
||||||
packagingDate = value;
|
packagingDate = value;
|
||||||
} else if ("15".equals(ai)) {
|
break;
|
||||||
|
case "15":
|
||||||
bestBeforeDate = value;
|
bestBeforeDate = value;
|
||||||
} else if ("17".equals(ai)) {
|
break;
|
||||||
|
case "17":
|
||||||
expirationDate = value;
|
expirationDate = value;
|
||||||
} else if ("3100".equals(ai) || "3101".equals(ai)
|
break;
|
||||||
|| "3102".equals(ai) || "3103".equals(ai)
|
case "3100":
|
||||||
|| "3104".equals(ai) || "3105".equals(ai)
|
case "3101":
|
||||||
|| "3106".equals(ai) || "3107".equals(ai)
|
case "3102":
|
||||||
|| "3108".equals(ai) || "3109".equals(ai)) {
|
case "3103":
|
||||||
|
case "3104":
|
||||||
|
case "3105":
|
||||||
|
case "3106":
|
||||||
|
case "3107":
|
||||||
|
case "3108":
|
||||||
|
case "3109":
|
||||||
weight = value;
|
weight = value;
|
||||||
weightType = ExpandedProductParsedResult.KILOGRAM;
|
weightType = ExpandedProductParsedResult.KILOGRAM;
|
||||||
weightIncrement = ai.substring(3);
|
weightIncrement = ai.substring(3);
|
||||||
} else if ("3200".equals(ai) || "3201".equals(ai)
|
break;
|
||||||
|| "3202".equals(ai) || "3203".equals(ai)
|
case "3200":
|
||||||
|| "3204".equals(ai) || "3205".equals(ai)
|
case "3201":
|
||||||
|| "3206".equals(ai) || "3207".equals(ai)
|
case "3202":
|
||||||
|| "3208".equals(ai) || "3209".equals(ai)) {
|
case "3203":
|
||||||
|
case "3204":
|
||||||
|
case "3205":
|
||||||
|
case "3206":
|
||||||
|
case "3207":
|
||||||
|
case "3208":
|
||||||
|
case "3209":
|
||||||
weight = value;
|
weight = value;
|
||||||
weightType = ExpandedProductParsedResult.POUND;
|
weightType = ExpandedProductParsedResult.POUND;
|
||||||
weightIncrement = ai.substring(3);
|
weightIncrement = ai.substring(3);
|
||||||
} else if ("3920".equals(ai) || "3921".equals(ai)
|
break;
|
||||||
|| "3922".equals(ai) || "3923".equals(ai)) {
|
case "3920":
|
||||||
|
case "3921":
|
||||||
|
case "3922":
|
||||||
|
case "3923":
|
||||||
price = value;
|
price = value;
|
||||||
priceIncrement = ai.substring(3);
|
priceIncrement = ai.substring(3);
|
||||||
} else if ("3930".equals(ai) || "3931".equals(ai)
|
break;
|
||||||
|| "3932".equals(ai) || "3933".equals(ai)) {
|
case "3930":
|
||||||
|
case "3931":
|
||||||
|
case "3932":
|
||||||
|
case "3933":
|
||||||
if (value.length() < 4) {
|
if (value.length() < 4) {
|
||||||
// The value must have more of 3 symbols (3 for currency and
|
// The value must have more of 3 symbols (3 for currency and
|
||||||
// 1 at least for the price)
|
// 1 at least for the price)
|
||||||
|
@ -122,9 +147,11 @@ public final class ExpandedProductResultParser extends ResultParser {
|
||||||
price = value.substring(3);
|
price = value.substring(3);
|
||||||
priceCurrency = value.substring(0, 3);
|
priceCurrency = value.substring(0, 3);
|
||||||
priceIncrement = ai.substring(3);
|
priceIncrement = ai.substring(3);
|
||||||
} else {
|
break;
|
||||||
|
default:
|
||||||
// No match with common AIs
|
// No match with common AIs
|
||||||
uncommonAIs.put(ai, value);
|
uncommonAIs.put(ai, value);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ public abstract class ResultParser {
|
||||||
if (paramStart < 0) {
|
if (paramStart < 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Map<String,String> result = new HashMap<String,String>(3);
|
Map<String,String> result = new HashMap<>(3);
|
||||||
for (String keyValue : AMPERSAND.split(uri.substring(paramStart + 1))) {
|
for (String keyValue : AMPERSAND.split(uri.substring(paramStart + 1))) {
|
||||||
appendKeyValue(keyValue, result);
|
appendKeyValue(keyValue, result);
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,7 @@ public abstract class ResultParser {
|
||||||
} else {
|
} else {
|
||||||
// found a match
|
// found a match
|
||||||
if (matches == null) {
|
if (matches == null) {
|
||||||
matches = new ArrayList<String>(3); // lazy init
|
matches = new ArrayList<>(3); // lazy init
|
||||||
}
|
}
|
||||||
String element = unescapeBackslash(rawText.substring(start, i));
|
String element = unescapeBackslash(rawText.substring(start, i));
|
||||||
if (trim) {
|
if (trim) {
|
||||||
|
|
|
@ -71,8 +71,8 @@ public final class SMSMMSResultParser extends ResultParser {
|
||||||
|
|
||||||
int lastComma = -1;
|
int lastComma = -1;
|
||||||
int comma;
|
int comma;
|
||||||
List<String> numbers = new ArrayList<String>(1);
|
List<String> numbers = new ArrayList<>(1);
|
||||||
List<String> vias = new ArrayList<String>(1);
|
List<String> vias = new ArrayList<>(1);
|
||||||
while ((comma = smsURIWithoutQuery.indexOf(',', lastComma + 1)) > lastComma) {
|
while ((comma = smsURIWithoutQuery.indexOf(',', lastComma + 1)) > lastComma) {
|
||||||
String numberPart = smsURIWithoutQuery.substring(lastComma + 1, comma);
|
String numberPart = smsURIWithoutQuery.substring(lastComma + 1, comma);
|
||||||
addNumberVia(numbers, vias, numberPart);
|
addNumberVia(numbers, vias, numberPart);
|
||||||
|
|
|
@ -128,7 +128,7 @@ public final class VCardResultParser extends ResultParser {
|
||||||
if (metadataString != null) {
|
if (metadataString != null) {
|
||||||
for (String metadatum : SEMICOLON.split(metadataString)) {
|
for (String metadatum : SEMICOLON.split(metadataString)) {
|
||||||
if (metadata == null) {
|
if (metadata == null) {
|
||||||
metadata = new ArrayList<String>(1);
|
metadata = new ArrayList<>(1);
|
||||||
}
|
}
|
||||||
metadata.add(metadatum);
|
metadata.add(metadatum);
|
||||||
String[] metadatumTokens = EQUALS.split(metadatum, 2);
|
String[] metadatumTokens = EQUALS.split(metadatum, 2);
|
||||||
|
@ -166,7 +166,7 @@ public final class VCardResultParser extends ResultParser {
|
||||||
} else if (i > matchStart) {
|
} else if (i > matchStart) {
|
||||||
// found a match
|
// found a match
|
||||||
if (matches == null) {
|
if (matches == null) {
|
||||||
matches = new ArrayList<List<String>>(1); // lazy init
|
matches = new ArrayList<>(1); // lazy init
|
||||||
}
|
}
|
||||||
if (i >= 1 && rawText.charAt(i-1) == '\r') {
|
if (i >= 1 && rawText.charAt(i-1) == '\r') {
|
||||||
i--; // Back up over \r, which really should be there
|
i--; // Back up over \r, which really should be there
|
||||||
|
@ -189,7 +189,7 @@ public final class VCardResultParser extends ResultParser {
|
||||||
element = VCARD_ESCAPES.matcher(element).replaceAll("$1");
|
element = VCARD_ESCAPES.matcher(element).replaceAll("$1");
|
||||||
}
|
}
|
||||||
if (metadata == null) {
|
if (metadata == null) {
|
||||||
List<String> match = new ArrayList<String>(1);
|
List<String> match = new ArrayList<>(1);
|
||||||
match.add(element);
|
match.add(element);
|
||||||
matches.add(match);
|
matches.add(match);
|
||||||
} else {
|
} else {
|
||||||
|
@ -275,7 +275,7 @@ public final class VCardResultParser extends ResultParser {
|
||||||
if (lists == null || lists.isEmpty()) {
|
if (lists == null || lists.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
List<String> result = new ArrayList<String>(lists.size());
|
List<String> result = new ArrayList<>(lists.size());
|
||||||
for (List<String> list : lists) {
|
for (List<String> list : lists) {
|
||||||
String value = list.get(0);
|
String value = list.get(0);
|
||||||
if (value != null && !value.isEmpty()) {
|
if (value != null && !value.isEmpty()) {
|
||||||
|
@ -289,7 +289,7 @@ public final class VCardResultParser extends ResultParser {
|
||||||
if (lists == null || lists.isEmpty()) {
|
if (lists == null || lists.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
List<String> result = new ArrayList<String>(lists.size());
|
List<String> result = new ArrayList<>(lists.size());
|
||||||
for (List<String> list : lists) {
|
for (List<String> list : lists) {
|
||||||
String type = null;
|
String type = null;
|
||||||
for (int i = 1; i < list.size(); i++) {
|
for (int i = 1; i < list.size(); i++) {
|
||||||
|
|
|
@ -58,8 +58,8 @@ public enum CharacterSetECI {
|
||||||
GB18030(29, "GB2312", "EUC_CN", "GBK"),
|
GB18030(29, "GB2312", "EUC_CN", "GBK"),
|
||||||
EUC_KR(30, "EUC-KR");
|
EUC_KR(30, "EUC-KR");
|
||||||
|
|
||||||
private static final Map<Integer,CharacterSetECI> VALUE_TO_ECI = new HashMap<Integer,CharacterSetECI>();
|
private static final Map<Integer,CharacterSetECI> VALUE_TO_ECI = new HashMap<>();
|
||||||
private static final Map<String,CharacterSetECI> NAME_TO_ECI = new HashMap<String,CharacterSetECI>();
|
private static final Map<String,CharacterSetECI> NAME_TO_ECI = new HashMap<>();
|
||||||
static {
|
static {
|
||||||
for (CharacterSetECI eci : values()) {
|
for (CharacterSetECI eci : values()) {
|
||||||
for (int value : eci.values) {
|
for (int value : eci.values) {
|
||||||
|
|
|
@ -32,7 +32,7 @@ public final class ReedSolomonEncoder {
|
||||||
|
|
||||||
public ReedSolomonEncoder(GenericGF field) {
|
public ReedSolomonEncoder(GenericGF field) {
|
||||||
this.field = field;
|
this.field = field;
|
||||||
this.cachedGenerators = new ArrayList<GenericGFPoly>();
|
this.cachedGenerators = new ArrayList<>();
|
||||||
cachedGenerators.add(new GenericGFPoly(field, new int[]{1}));
|
cachedGenerators.add(new GenericGFPoly(field, new int[]{1}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ final class DecodedBitStreamParser {
|
||||||
BitSource bits = new BitSource(bytes);
|
BitSource bits = new BitSource(bytes);
|
||||||
StringBuilder result = new StringBuilder(100);
|
StringBuilder result = new StringBuilder(100);
|
||||||
StringBuilder resultTrailer = new StringBuilder(0);
|
StringBuilder resultTrailer = new StringBuilder(0);
|
||||||
List<byte[]> byteSegments = new ArrayList<byte[]>(1);
|
List<byte[]> byteSegments = new ArrayList<>(1);
|
||||||
Mode mode = Mode.ASCII_ENCODE;
|
Mode mode = Mode.ASCII_ENCODE;
|
||||||
do {
|
do {
|
||||||
if (mode == Mode.ASCII_ENCODE) {
|
if (mode == Mode.ASCII_ENCODE) {
|
||||||
|
|
|
@ -65,7 +65,7 @@ public final class Detector {
|
||||||
// Point A and D are across the diagonal from one another,
|
// Point A and D are across the diagonal from one another,
|
||||||
// as are B and C. Figure out which are the solid black lines
|
// as are B and C. Figure out which are the solid black lines
|
||||||
// by counting transitions
|
// by counting transitions
|
||||||
List<ResultPointsAndTransitions> transitions = new ArrayList<ResultPointsAndTransitions>(4);
|
List<ResultPointsAndTransitions> transitions = new ArrayList<>(4);
|
||||||
transitions.add(transitionsBetween(pointA, pointB));
|
transitions.add(transitionsBetween(pointA, pointB));
|
||||||
transitions.add(transitionsBetween(pointA, pointC));
|
transitions.add(transitionsBetween(pointA, pointC));
|
||||||
transitions.add(transitionsBetween(pointB, pointD));
|
transitions.add(transitionsBetween(pointB, pointD));
|
||||||
|
@ -79,7 +79,7 @@ public final class Detector {
|
||||||
|
|
||||||
// Figure out which point is their intersection by tallying up the number of times we see the
|
// Figure out which point is their intersection by tallying up the number of times we see the
|
||||||
// endpoints in the four endpoints. One will show up twice.
|
// endpoints in the four endpoints. One will show up twice.
|
||||||
Map<ResultPoint,Integer> pointCount = new HashMap<ResultPoint,Integer>();
|
Map<ResultPoint,Integer> pointCount = new HashMap<>();
|
||||||
increment(pointCount, lSideOne.getFrom());
|
increment(pointCount, lSideOne.getFrom());
|
||||||
increment(pointCount, lSideOne.getTo());
|
increment(pointCount, lSideOne.getTo());
|
||||||
increment(pointCount, lSideTwo.getFrom());
|
increment(pointCount, lSideTwo.getFrom());
|
||||||
|
|
|
@ -61,7 +61,7 @@ public final class GenericMultipleBarcodeReader implements MultipleBarcodeReader
|
||||||
@Override
|
@Override
|
||||||
public Result[] decodeMultiple(BinaryBitmap image, Map<DecodeHintType,?> hints)
|
public Result[] decodeMultiple(BinaryBitmap image, Map<DecodeHintType,?> hints)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
List<Result> results = new ArrayList<Result>();
|
List<Result> results = new ArrayList<>();
|
||||||
doDecodeMultiple(image, hints, results, 0, 0, 0);
|
doDecodeMultiple(image, hints, results, 0, 0, 0);
|
||||||
if (results.isEmpty()) {
|
if (results.isEmpty()) {
|
||||||
throw NotFoundException.getNotFoundInstance();
|
throw NotFoundException.getNotFoundInstance();
|
||||||
|
|
|
@ -52,7 +52,7 @@ public final class QRCodeMultiReader extends QRCodeReader implements MultipleBar
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result[] decodeMultiple(BinaryBitmap image, Map<DecodeHintType,?> hints) throws NotFoundException {
|
public Result[] decodeMultiple(BinaryBitmap image, Map<DecodeHintType,?> hints) throws NotFoundException {
|
||||||
List<Result> results = new ArrayList<Result>();
|
List<Result> results = new ArrayList<>();
|
||||||
DetectorResult[] detectorResults = new MultiDetector(image.getBlackMatrix()).detectMulti(hints);
|
DetectorResult[] detectorResults = new MultiDetector(image.getBlackMatrix()).detectMulti(hints);
|
||||||
for (DetectorResult detectorResult : detectorResults) {
|
for (DetectorResult detectorResult : detectorResults) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -55,7 +55,7 @@ public final class MultiDetector extends Detector {
|
||||||
throw NotFoundException.getNotFoundInstance();
|
throw NotFoundException.getNotFoundInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<DetectorResult> result = new ArrayList<DetectorResult>();
|
List<DetectorResult> result = new ArrayList<>();
|
||||||
for (FinderPatternInfo info : infos) {
|
for (FinderPatternInfo info : infos) {
|
||||||
try {
|
try {
|
||||||
result.add(processFinderPatternInfo(info));
|
result.add(processFinderPatternInfo(info));
|
||||||
|
|
|
@ -143,7 +143,7 @@ final class MultiFinderPatternFinder extends FinderPatternFinder {
|
||||||
* So, if the layout seems right, lets have the decoder try to decode.
|
* So, if the layout seems right, lets have the decoder try to decode.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
List<FinderPattern[]> results = new ArrayList<FinderPattern[]>(); // holder for the results
|
List<FinderPattern[]> results = new ArrayList<>(); // holder for the results
|
||||||
|
|
||||||
for (int i1 = 0; i1 < (size - 2); i1++) {
|
for (int i1 = 0; i1 < (size - 2); i1++) {
|
||||||
FinderPattern p1 = possibleCenters.get(i1);
|
FinderPattern p1 = possibleCenters.get(i1);
|
||||||
|
@ -294,7 +294,7 @@ final class MultiFinderPatternFinder extends FinderPatternFinder {
|
||||||
} // end if foundPatternCross
|
} // end if foundPatternCross
|
||||||
} // for i=iSkip-1 ...
|
} // for i=iSkip-1 ...
|
||||||
FinderPattern[][] patternInfo = selectMutipleBestPatterns();
|
FinderPattern[][] patternInfo = selectMutipleBestPatterns();
|
||||||
List<FinderPatternInfo> result = new ArrayList<FinderPatternInfo>();
|
List<FinderPatternInfo> result = new ArrayList<>();
|
||||||
for (FinderPattern[] pattern : patternInfo) {
|
for (FinderPattern[] pattern : patternInfo) {
|
||||||
ResultPoint.orderBestPatterns(pattern);
|
ResultPoint.orderBestPatterns(pattern);
|
||||||
result.add(new FinderPatternInfo(pattern));
|
result.add(new FinderPatternInfo(pattern));
|
||||||
|
|
|
@ -241,7 +241,7 @@ public final class Code128Reader extends OneDReader {
|
||||||
int[] startPatternInfo = findStartPattern(row);
|
int[] startPatternInfo = findStartPattern(row);
|
||||||
int startCode = startPatternInfo[2];
|
int startCode = startPatternInfo[2];
|
||||||
|
|
||||||
List<Byte> rawCodes = new ArrayList<Byte>(20);
|
List<Byte> rawCodes = new ArrayList<>(20);
|
||||||
rawCodes.add((byte) startCode);
|
rawCodes.add((byte) startCode);
|
||||||
|
|
||||||
int codeSet;
|
int codeSet;
|
||||||
|
|
|
@ -85,7 +85,7 @@ public final class Code128Writer extends OneDimensionalCodeWriter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Collection<int[]> patterns = new ArrayList<int[]>(); // temporary storage for patterns
|
Collection<int[]> patterns = new ArrayList<>(); // temporary storage for patterns
|
||||||
int checkSum = 0;
|
int checkSum = 0;
|
||||||
int checkWeight = 1;
|
int checkWeight = 1;
|
||||||
int codeSet = 0; // selected code (CODE_CODE_B or CODE_CODE_C)
|
int codeSet = 0; // selected code (CODE_CODE_B or CODE_CODE_C)
|
||||||
|
|
|
@ -30,8 +30,8 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
final class EANManufacturerOrgSupport {
|
final class EANManufacturerOrgSupport {
|
||||||
|
|
||||||
private final List<int[]> ranges = new ArrayList<int[]>();
|
private final List<int[]> ranges = new ArrayList<>();
|
||||||
private final List<String> countryIdentifiers = new ArrayList<String>();
|
private final List<String> countryIdentifiers = new ArrayList<>();
|
||||||
|
|
||||||
String lookupCountryIdentifier(String productCode) {
|
String lookupCountryIdentifier(String productCode) {
|
||||||
initIfNeeded();
|
initIfNeeded();
|
||||||
|
|
|
@ -44,7 +44,7 @@ public final class MultiFormatOneDReader extends OneDReader {
|
||||||
(Collection<BarcodeFormat>) hints.get(DecodeHintType.POSSIBLE_FORMATS);
|
(Collection<BarcodeFormat>) hints.get(DecodeHintType.POSSIBLE_FORMATS);
|
||||||
boolean useCode39CheckDigit = hints != null &&
|
boolean useCode39CheckDigit = hints != null &&
|
||||||
hints.get(DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT) != null;
|
hints.get(DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT) != null;
|
||||||
Collection<OneDReader> readers = new ArrayList<OneDReader>();
|
Collection<OneDReader> readers = new ArrayList<>();
|
||||||
if (possibleFormats != null) {
|
if (possibleFormats != null) {
|
||||||
if (possibleFormats.contains(BarcodeFormat.EAN_13) ||
|
if (possibleFormats.contains(BarcodeFormat.EAN_13) ||
|
||||||
possibleFormats.contains(BarcodeFormat.UPC_A) ||
|
possibleFormats.contains(BarcodeFormat.UPC_A) ||
|
||||||
|
|
|
@ -43,7 +43,7 @@ public final class MultiFormatUPCEANReader extends OneDReader {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Collection<BarcodeFormat> possibleFormats = hints == null ? null :
|
Collection<BarcodeFormat> possibleFormats = hints == null ? null :
|
||||||
(Collection<BarcodeFormat>) hints.get(DecodeHintType.POSSIBLE_FORMATS);
|
(Collection<BarcodeFormat>) hints.get(DecodeHintType.POSSIBLE_FORMATS);
|
||||||
Collection<UPCEANReader> readers = new ArrayList<UPCEANReader>();
|
Collection<UPCEANReader> readers = new ArrayList<>();
|
||||||
if (possibleFormats != null) {
|
if (possibleFormats != null) {
|
||||||
if (possibleFormats.contains(BarcodeFormat.EAN_13)) {
|
if (possibleFormats.contains(BarcodeFormat.EAN_13)) {
|
||||||
readers.add(new EAN13Reader());
|
readers.add(new EAN13Reader());
|
||||||
|
|
|
@ -147,7 +147,7 @@ public abstract class OneDReader implements Reader {
|
||||||
// don't want to clutter with noise from every single row scan -- just the scans
|
// don't want to clutter with noise from every single row scan -- just the scans
|
||||||
// that start on the center line.
|
// that start on the center line.
|
||||||
if (hints != null && hints.containsKey(DecodeHintType.NEED_RESULT_POINT_CALLBACK)) {
|
if (hints != null && hints.containsKey(DecodeHintType.NEED_RESULT_POINT_CALLBACK)) {
|
||||||
Map<DecodeHintType,Object> newHints = new EnumMap<DecodeHintType,Object>(DecodeHintType.class);
|
Map<DecodeHintType,Object> newHints = new EnumMap<>(DecodeHintType.class);
|
||||||
newHints.putAll(hints);
|
newHints.putAll(hints);
|
||||||
newHints.remove(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
|
newHints.remove(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
|
||||||
hints = newHints;
|
hints = newHints;
|
||||||
|
|
|
@ -104,7 +104,7 @@ final class UPCEANExtension2Support {
|
||||||
if (raw.length() != 2) {
|
if (raw.length() != 2) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Map<ResultMetadataType,Object> result = new EnumMap<ResultMetadataType,Object>(ResultMetadataType.class);
|
Map<ResultMetadataType,Object> result = new EnumMap<>(ResultMetadataType.class);
|
||||||
result.put(ResultMetadataType.ISSUE_NUMBER, Integer.valueOf(raw));
|
result.put(ResultMetadataType.ISSUE_NUMBER, Integer.valueOf(raw));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,7 @@ final class UPCEANExtension5Support {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Map<ResultMetadataType,Object> result = new EnumMap<ResultMetadataType,Object>(ResultMetadataType.class);
|
Map<ResultMetadataType,Object> result = new EnumMap<>(ResultMetadataType.class);
|
||||||
result.put(ResultMetadataType.SUGGESTED_PRICE, value);
|
result.put(ResultMetadataType.SUGGESTED_PRICE, value);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,8 +57,8 @@ public final class RSS14Reader extends AbstractRSSReader {
|
||||||
private final List<Pair> possibleRightPairs;
|
private final List<Pair> possibleRightPairs;
|
||||||
|
|
||||||
public RSS14Reader() {
|
public RSS14Reader() {
|
||||||
possibleLeftPairs = new ArrayList<Pair>();
|
possibleLeftPairs = new ArrayList<>();
|
||||||
possibleRightPairs = new ArrayList<Pair>();
|
possibleRightPairs = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -30,7 +30,7 @@ final class ExpandedRow {
|
||||||
private final boolean wasReversed;
|
private final boolean wasReversed;
|
||||||
|
|
||||||
ExpandedRow(List<ExpandedPair> pairs, int rowNumber, boolean wasReversed) {
|
ExpandedRow(List<ExpandedPair> pairs, int rowNumber, boolean wasReversed) {
|
||||||
this.pairs = new ArrayList<ExpandedPair>(pairs);
|
this.pairs = new ArrayList<>(pairs);
|
||||||
this.rowNumber = rowNumber;
|
this.rowNumber = rowNumber;
|
||||||
this.wasReversed = wasReversed;
|
this.wasReversed = wasReversed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,8 +114,8 @@ public final class RSSExpandedReader extends AbstractRSSReader {
|
||||||
|
|
||||||
private static final int MAX_PAIRS = 11;
|
private static final int MAX_PAIRS = 11;
|
||||||
|
|
||||||
private final List<ExpandedPair> pairs = new ArrayList<ExpandedPair>(MAX_PAIRS);
|
private final List<ExpandedPair> pairs = new ArrayList<>(MAX_PAIRS);
|
||||||
private final List<ExpandedRow> rows = new ArrayList<ExpandedRow>();
|
private final List<ExpandedRow> rows = new ArrayList<>();
|
||||||
private final int [] startEnd = new int[2];
|
private final int [] startEnd = new int[2];
|
||||||
//private final int [] currentSequence = new int[LONGEST_SEQUENCE_SIZE];
|
//private final int [] currentSequence = new int[LONGEST_SEQUENCE_SIZE];
|
||||||
private boolean startFromEven = false;
|
private boolean startFromEven = false;
|
||||||
|
@ -234,7 +234,7 @@ public final class RSSExpandedReader extends AbstractRSSReader {
|
||||||
return this.pairs;
|
return this.pairs;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ExpandedRow> rs = new ArrayList<ExpandedRow>();
|
List<ExpandedRow> rs = new ArrayList<>();
|
||||||
rs.addAll(collectedRows);
|
rs.addAll(collectedRows);
|
||||||
rs.add(row);
|
rs.add(row);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -74,16 +74,14 @@ public final class PDF417Reader implements Reader, MultipleBarcodeReader {
|
||||||
public Result[] decodeMultiple(BinaryBitmap image, Map<DecodeHintType,?> hints) throws NotFoundException {
|
public Result[] decodeMultiple(BinaryBitmap image, Map<DecodeHintType,?> hints) throws NotFoundException {
|
||||||
try {
|
try {
|
||||||
return decode(image, hints, true);
|
return decode(image, hints, true);
|
||||||
} catch (FormatException ignored) {
|
} catch (FormatException | ChecksumException ignored) {
|
||||||
throw NotFoundException.getNotFoundInstance();
|
|
||||||
} catch (ChecksumException ignored) {
|
|
||||||
throw NotFoundException.getNotFoundInstance();
|
throw NotFoundException.getNotFoundInstance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Result[] decode(BinaryBitmap image, Map<DecodeHintType, ?> hints, boolean multiple)
|
private static Result[] decode(BinaryBitmap image, Map<DecodeHintType, ?> hints, boolean multiple)
|
||||||
throws NotFoundException, FormatException, ChecksumException {
|
throws NotFoundException, FormatException, ChecksumException {
|
||||||
List<Result> results = new ArrayList<Result>();
|
List<Result> results = new ArrayList<>();
|
||||||
PDF417DetectorResult detectorResult = Detector.detect(image, hints, multiple);
|
PDF417DetectorResult detectorResult = Detector.detect(image, hints, multiple);
|
||||||
for (ResultPoint[] points : detectorResult.getPoints()) {
|
for (ResultPoint[] points : detectorResult.getPoints()) {
|
||||||
DecoderResult decoderResult = PDF417ScanningDecoder.decode(detectorResult.getBits(), points[4], points[5],
|
DecoderResult decoderResult = PDF417ScanningDecoder.decode(detectorResult.getBits(), points[4], points[5],
|
||||||
|
|
|
@ -28,7 +28,7 @@ import java.util.Map.Entry;
|
||||||
* @author Guenther Grau
|
* @author Guenther Grau
|
||||||
*/
|
*/
|
||||||
final class BarcodeValue {
|
final class BarcodeValue {
|
||||||
private final Map<Integer,Integer> values = new HashMap<Integer,Integer>();
|
private final Map<Integer,Integer> values = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an occurrence of a value
|
* Add an occurrence of a value
|
||||||
|
@ -48,7 +48,7 @@ final class BarcodeValue {
|
||||||
*/
|
*/
|
||||||
int[] getValue() {
|
int[] getValue() {
|
||||||
int maxConfidence = -1;
|
int maxConfidence = -1;
|
||||||
Collection<Integer> result = new ArrayList<Integer>();
|
Collection<Integer> result = new ArrayList<>();
|
||||||
for (Entry<Integer,Integer> entry : values.entrySet()) {
|
for (Entry<Integer,Integer> entry : values.entrySet()) {
|
||||||
if (entry.getValue() > maxConfidence) {
|
if (entry.getValue() > maxConfidence) {
|
||||||
maxConfidence = entry.getValue();
|
maxConfidence = entry.getValue();
|
||||||
|
|
|
@ -249,10 +249,10 @@ public final class PDF417ScanningDecoder {
|
||||||
ChecksumException, NotFoundException {
|
ChecksumException, NotFoundException {
|
||||||
BarcodeValue[][] barcodeMatrix = createBarcodeMatrix(detectionResult);
|
BarcodeValue[][] barcodeMatrix = createBarcodeMatrix(detectionResult);
|
||||||
adjustCodewordCount(detectionResult, barcodeMatrix);
|
adjustCodewordCount(detectionResult, barcodeMatrix);
|
||||||
Collection<Integer> erasures = new ArrayList<Integer>();
|
Collection<Integer> erasures = new ArrayList<>();
|
||||||
int[] codewords = new int[detectionResult.getBarcodeRowCount() * detectionResult.getBarcodeColumnCount()];
|
int[] codewords = new int[detectionResult.getBarcodeRowCount() * detectionResult.getBarcodeColumnCount()];
|
||||||
List<int[]> ambiguousIndexValuesList = new ArrayList<int[]>();
|
List<int[]> ambiguousIndexValuesList = new ArrayList<>();
|
||||||
List<Integer> ambiguousIndexesList = new ArrayList<Integer>();
|
List<Integer> ambiguousIndexesList = new ArrayList<>();
|
||||||
for (int row = 0; row < detectionResult.getBarcodeRowCount(); row++) {
|
for (int row = 0; row < detectionResult.getBarcodeRowCount(); row++) {
|
||||||
for (int column = 0; column < detectionResult.getBarcodeColumnCount(); column++) {
|
for (int column = 0; column < detectionResult.getBarcodeColumnCount(); column++) {
|
||||||
int[] values = barcodeMatrix[row][column + 1].getValue();
|
int[] values = barcodeMatrix[row][column + 1].getValue();
|
||||||
|
|
|
@ -96,7 +96,7 @@ public final class Detector {
|
||||||
* @return List of ResultPoint arrays containing the coordinates of found barcodes
|
* @return List of ResultPoint arrays containing the coordinates of found barcodes
|
||||||
*/
|
*/
|
||||||
private static List<ResultPoint[]> detect(boolean multiple, BitMatrix bitMatrix) {
|
private static List<ResultPoint[]> detect(boolean multiple, BitMatrix bitMatrix) {
|
||||||
List<ResultPoint[]> barcodeCoordinates = new ArrayList<ResultPoint[]>();
|
List<ResultPoint[]> barcodeCoordinates = new ArrayList<>();
|
||||||
int row = 0;
|
int row = 0;
|
||||||
int column = 0;
|
int column = 0;
|
||||||
boolean foundBarcodeInRow = false;
|
boolean foundBarcodeInRow = false;
|
||||||
|
|
|
@ -59,7 +59,7 @@ final class DecodedBitStreamParser {
|
||||||
Map<DecodeHintType,?> hints) throws FormatException {
|
Map<DecodeHintType,?> hints) throws FormatException {
|
||||||
BitSource bits = new BitSource(bytes);
|
BitSource bits = new BitSource(bytes);
|
||||||
StringBuilder result = new StringBuilder(50);
|
StringBuilder result = new StringBuilder(50);
|
||||||
List<byte[]> byteSegments = new ArrayList<byte[]>(1);
|
List<byte[]> byteSegments = new ArrayList<>(1);
|
||||||
try {
|
try {
|
||||||
CharacterSetECI currentCharacterSetECI = null;
|
CharacterSetECI currentCharacterSetECI = null;
|
||||||
boolean fc1InEffect = false;
|
boolean fc1InEffect = false;
|
||||||
|
|
|
@ -125,17 +125,7 @@ public final class Decoder {
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
} catch (FormatException e) {
|
} catch (FormatException | ChecksumException e) {
|
||||||
// Throw the exception from the original reading
|
|
||||||
if (fe != null) {
|
|
||||||
throw fe;
|
|
||||||
}
|
|
||||||
if (ce != null) {
|
|
||||||
throw ce;
|
|
||||||
}
|
|
||||||
throw e;
|
|
||||||
|
|
||||||
} catch (ChecksumException e) {
|
|
||||||
// Throw the exception from the original reading
|
// Throw the exception from the original reading
|
||||||
if (fe != null) {
|
if (fe != null) {
|
||||||
throw fe;
|
throw fe;
|
||||||
|
|
|
@ -67,7 +67,7 @@ final class AlignmentPatternFinder {
|
||||||
float moduleSize,
|
float moduleSize,
|
||||||
ResultPointCallback resultPointCallback) {
|
ResultPointCallback resultPointCallback) {
|
||||||
this.image = image;
|
this.image = image;
|
||||||
this.possibleCenters = new ArrayList<AlignmentPattern>(5);
|
this.possibleCenters = new ArrayList<>(5);
|
||||||
this.startX = startX;
|
this.startX = startX;
|
||||||
this.startY = startY;
|
this.startY = startY;
|
||||||
this.width = width;
|
this.width = width;
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class FinderPatternFinder {
|
||||||
|
|
||||||
public FinderPatternFinder(BitMatrix image, ResultPointCallback resultPointCallback) {
|
public FinderPatternFinder(BitMatrix image, ResultPointCallback resultPointCallback) {
|
||||||
this.image = image;
|
this.image = image;
|
||||||
this.possibleCenters = new ArrayList<FinderPattern>();
|
this.possibleCenters = new ArrayList<>();
|
||||||
this.crossCheckStateCount = new int[5];
|
this.crossCheckStateCount = new int[5];
|
||||||
this.resultPointCallback = resultPointCallback;
|
this.resultPointCallback = resultPointCallback;
|
||||||
}
|
}
|
||||||
|
|
|
@ -376,7 +376,7 @@ public final class Encoder {
|
||||||
int maxNumEcBytes = 0;
|
int maxNumEcBytes = 0;
|
||||||
|
|
||||||
// Since, we know the number of reedsolmon blocks, we can initialize the vector with the number.
|
// Since, we know the number of reedsolmon blocks, we can initialize the vector with the number.
|
||||||
Collection<BlockPair> blocks = new ArrayList<BlockPair>(numRSBlocks);
|
Collection<BlockPair> blocks = new ArrayList<>(numRSBlocks);
|
||||||
|
|
||||||
for (int i = 0; i < numRSBlocks; ++i) {
|
for (int i = 0; i < numRSBlocks; ++i) {
|
||||||
int[] numDataBytesInBlock = new int[1];
|
int[] numDataBytesInBlock = new int[1];
|
||||||
|
|
|
@ -92,7 +92,7 @@ public final class DetectorTest extends Assert {
|
||||||
// Try a few random three-bit errors;
|
// Try a few random three-bit errors;
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
BitMatrix copy = clone(matrix);
|
BitMatrix copy = clone(matrix);
|
||||||
Collection<Integer> errors = new TreeSet<Integer>();
|
Collection<Integer> errors = new TreeSet<>();
|
||||||
while (errors.size() < 3) {
|
while (errors.size() < 3) {
|
||||||
// Quick and dirty way of getting three distinct integers between 1 and n.
|
// Quick and dirty way of getting three distinct integers between 1 and n.
|
||||||
errors.add(random.nextInt(orientationPoints.size()));
|
errors.add(random.nextInt(orientationPoints.size()));
|
||||||
|
@ -176,7 +176,7 @@ public final class DetectorTest extends Assert {
|
||||||
private static List<Point> getOrientationPoints(AztecCode code) {
|
private static List<Point> getOrientationPoints(AztecCode code) {
|
||||||
int center = code.getMatrix().getWidth() / 2;
|
int center = code.getMatrix().getWidth() / 2;
|
||||||
int offset = code.isCompact() ? 5 : 7;
|
int offset = code.isCompact() ? 5 : 7;
|
||||||
List<Point> result = new ArrayList<Point>();
|
List<Point> result = new ArrayList<>();
|
||||||
for (int xSign = -1; xSign <= 1; xSign += 2) {
|
for (int xSign = -1; xSign <= 1; xSign += 2) {
|
||||||
for (int ySign = -1; ySign <= 1; ySign += 2) {
|
for (int ySign = -1; ySign <= 1; ySign += 2) {
|
||||||
result.add(new Point(center + xSign * offset, center + ySign * offset));
|
result.add(new Point(center + xSign * offset, center + ySign * offset));
|
||||||
|
|
|
@ -469,7 +469,7 @@ public final class EncoderTest extends Assert {
|
||||||
// 1. Perform an encode-decode round-trip because it can be lossy.
|
// 1. Perform an encode-decode round-trip because it can be lossy.
|
||||||
// 2. Aztec Decoder currently always decodes the data with a LATIN-1 charset:
|
// 2. Aztec Decoder currently always decodes the data with a LATIN-1 charset:
|
||||||
String expectedData = new String(data.getBytes(Charset.forName(charset)), LATIN_1);
|
String expectedData = new String(data.getBytes(Charset.forName(charset)), LATIN_1);
|
||||||
Map<EncodeHintType,Object> hints = new EnumMap<EncodeHintType,Object>(EncodeHintType.class);
|
Map<EncodeHintType,Object> hints = new EnumMap<>(EncodeHintType.class);
|
||||||
hints.put(EncodeHintType.CHARACTER_SET, charset);
|
hints.put(EncodeHintType.CHARACTER_SET, charset);
|
||||||
hints.put(EncodeHintType.ERROR_CORRECTION, eccPercent);
|
hints.put(EncodeHintType.ERROR_CORRECTION, eccPercent);
|
||||||
AztecWriter writer = new AztecWriter();
|
AztecWriter writer = new AztecWriter();
|
||||||
|
|
|
@ -42,7 +42,7 @@ public final class ExpandedProductParsedResultTestCase extends Assert {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_RSSExpanded() {
|
public void test_RSSExpanded() {
|
||||||
Map<String,String> uncommonAIs = new HashMap<String,String>();
|
Map<String,String> uncommonAIs = new HashMap<>();
|
||||||
uncommonAIs.put("123", "544654");
|
uncommonAIs.put("123", "544654");
|
||||||
Result result =
|
Result result =
|
||||||
new Result("(01)66546(13)001205(3932)4455(3102)6544(123)544654", null, null, BarcodeFormat.RSS_EXPANDED);
|
new Result("(01)66546(13)001205(3932)4455(3102)6544(123)544654", null, null, BarcodeFormat.RSS_EXPANDED);
|
||||||
|
|
|
@ -86,7 +86,7 @@ public abstract class AbstractBlackBoxTestCase extends Assert {
|
||||||
this.testBase = testBase;
|
this.testBase = testBase;
|
||||||
this.barcodeReader = barcodeReader;
|
this.barcodeReader = barcodeReader;
|
||||||
this.expectedFormat = expectedFormat;
|
this.expectedFormat = expectedFormat;
|
||||||
testResults = new ArrayList<TestResult>();
|
testResults = new ArrayList<>();
|
||||||
|
|
||||||
System.setProperty("java.util.logging.SimpleFormatter.format", "%4$s: %5$s%6$s%n");
|
System.setProperty("java.util.logging.SimpleFormatter.format", "%4$s: %5$s%6$s%n");
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ public abstract class AbstractBlackBoxTestCase extends Assert {
|
||||||
|
|
||||||
String suffix = String.format(" (%srotation: %d)", tryHarder ? "try harder, " : "", (int) rotation);
|
String suffix = String.format(" (%srotation: %d)", tryHarder ? "try harder, " : "", (int) rotation);
|
||||||
|
|
||||||
Map<DecodeHintType,Object> hints = new EnumMap<DecodeHintType,Object>(DecodeHintType.class);
|
Map<DecodeHintType,Object> hints = new EnumMap<>(DecodeHintType.class);
|
||||||
if (tryHarder) {
|
if (tryHarder) {
|
||||||
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
|
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ public abstract class AbstractNegativeBlackBoxTestCase extends AbstractBlackBoxT
|
||||||
// Use the multiformat reader to evaluate all decoders in the system.
|
// Use the multiformat reader to evaluate all decoders in the system.
|
||||||
protected AbstractNegativeBlackBoxTestCase(String testBasePathSuffix) {
|
protected AbstractNegativeBlackBoxTestCase(String testBasePathSuffix) {
|
||||||
super(testBasePathSuffix, new MultiFormatReader(), null);
|
super(testBasePathSuffix, new MultiFormatReader(), null);
|
||||||
testResults = new ArrayList<TestResult>();
|
testResults = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void addTest(int falsePositivesAllowed, float rotation) {
|
protected final void addTest(int falsePositivesAllowed, float rotation) {
|
||||||
|
@ -143,7 +143,7 @@ public abstract class AbstractNegativeBlackBoxTestCase extends AbstractBlackBoxT
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try "try harder" getMode
|
// Try "try harder" getMode
|
||||||
Map<DecodeHintType,Object> hints = new EnumMap<DecodeHintType,Object>(DecodeHintType.class);
|
Map<DecodeHintType,Object> hints = new EnumMap<>(DecodeHintType.class);
|
||||||
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
|
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
|
||||||
try {
|
try {
|
||||||
result = getReader().decode(bitmap, hints);
|
result = getReader().decode(bitmap, hints);
|
||||||
|
|
|
@ -35,7 +35,7 @@ public final class DataMatrixWriterTestCase extends Assert {
|
||||||
@Test
|
@Test
|
||||||
public void testDataMatrixImageWriter() {
|
public void testDataMatrixImageWriter() {
|
||||||
|
|
||||||
Map<EncodeHintType,Object> hints = new EnumMap<EncodeHintType,Object>(EncodeHintType.class);
|
Map<EncodeHintType,Object> hints = new EnumMap<>(EncodeHintType.class);
|
||||||
hints.put(EncodeHintType.DATA_MATRIX_SHAPE, SymbolShapeHint.FORCE_SQUARE);
|
hints.put(EncodeHintType.DATA_MATRIX_SHAPE, SymbolShapeHint.FORCE_SQUARE);
|
||||||
|
|
||||||
int bigEnough = 64;
|
int bigEnough = 64;
|
||||||
|
@ -49,7 +49,7 @@ public final class DataMatrixWriterTestCase extends Assert {
|
||||||
@Test
|
@Test
|
||||||
public void testDataMatrixWriter() {
|
public void testDataMatrixWriter() {
|
||||||
|
|
||||||
Map<EncodeHintType,Object> hints = new EnumMap<EncodeHintType,Object>(EncodeHintType.class);
|
Map<EncodeHintType,Object> hints = new EnumMap<>(EncodeHintType.class);
|
||||||
hints.put(EncodeHintType.DATA_MATRIX_SHAPE, SymbolShapeHint.FORCE_SQUARE);
|
hints.put(EncodeHintType.DATA_MATRIX_SHAPE, SymbolShapeHint.FORCE_SQUARE);
|
||||||
|
|
||||||
int bigEnough = 14;
|
int bigEnough = 14;
|
||||||
|
|
|
@ -56,7 +56,7 @@ public final class BitArrayBuilderTest extends Assert {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BitArray buildBitArray(int[][] pairValues) {
|
private static BitArray buildBitArray(int[][] pairValues) {
|
||||||
List<ExpandedPair> pairs = new ArrayList<ExpandedPair>();
|
List<ExpandedPair> pairs = new ArrayList<>();
|
||||||
for(int i = 0; i < pairValues.length; ++i){
|
for(int i = 0; i < pairValues.length; ++i){
|
||||||
int [] pair = pairValues[i];
|
int [] pair = pairValues[i];
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ public final class RSSExpandedInternalTestCase extends Assert {
|
||||||
BinaryBitmap binaryMap = new BinaryBitmap(new GlobalHistogramBinarizer(new BufferedImageLuminanceSource(image)));
|
BinaryBitmap binaryMap = new BinaryBitmap(new GlobalHistogramBinarizer(new BufferedImageLuminanceSource(image)));
|
||||||
int rowNumber = binaryMap.getHeight() / 2;
|
int rowNumber = binaryMap.getHeight() / 2;
|
||||||
BitArray row = binaryMap.getBlackRow(rowNumber, null);
|
BitArray row = binaryMap.getBlackRow(rowNumber, null);
|
||||||
List<ExpandedPair> previousPairs = new ArrayList<ExpandedPair>();
|
List<ExpandedPair> previousPairs = new ArrayList<>();
|
||||||
|
|
||||||
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
|
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
|
||||||
ExpandedPair pair1 = rssExpandedReader.retrieveNextPair(row, previousPairs, rowNumber);
|
ExpandedPair pair1 = rssExpandedReader.retrieveNextPair(row, previousPairs, rowNumber);
|
||||||
|
@ -108,7 +108,7 @@ public final class RSSExpandedInternalTestCase extends Assert {
|
||||||
BinaryBitmap binaryMap = new BinaryBitmap(new GlobalHistogramBinarizer(new BufferedImageLuminanceSource(image)));
|
BinaryBitmap binaryMap = new BinaryBitmap(new GlobalHistogramBinarizer(new BufferedImageLuminanceSource(image)));
|
||||||
int rowNumber = binaryMap.getHeight() / 2;
|
int rowNumber = binaryMap.getHeight() / 2;
|
||||||
BitArray row = binaryMap.getBlackRow(rowNumber, null);
|
BitArray row = binaryMap.getBlackRow(rowNumber, null);
|
||||||
List<ExpandedPair> previousPairs = new ArrayList<ExpandedPair>();
|
List<ExpandedPair> previousPairs = new ArrayList<>();
|
||||||
|
|
||||||
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
|
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
|
||||||
ExpandedPair pair1 = rssExpandedReader.retrieveNextPair(row, previousPairs, rowNumber);
|
ExpandedPair pair1 = rssExpandedReader.retrieveNextPair(row, previousPairs, rowNumber);
|
||||||
|
|
|
@ -63,7 +63,7 @@ public final class PDF417BlackBox4TestCase extends AbstractBlackBoxTestCase {
|
||||||
private static final String TEST_BASE_PATH_SUFFIX = "src/test/resources/blackbox/pdf417-4";
|
private static final String TEST_BASE_PATH_SUFFIX = "src/test/resources/blackbox/pdf417-4";
|
||||||
private final PDF417Reader barcodeReader = new PDF417Reader();
|
private final PDF417Reader barcodeReader = new PDF417Reader();
|
||||||
|
|
||||||
private final List<TestResult> testResults = new ArrayList<TestResult>();
|
private final List<TestResult> testResults = new ArrayList<>();
|
||||||
private File testBase;
|
private File testBase;
|
||||||
|
|
||||||
public PDF417BlackBox4TestCase() {
|
public PDF417BlackBox4TestCase() {
|
||||||
|
@ -109,7 +109,7 @@ public final class PDF417BlackBox4TestCase extends AbstractBlackBoxTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int x = 0; x < testCount; x++) {
|
for (int x = 0; x < testCount; x++) {
|
||||||
List<Result> results = new ArrayList<Result>();
|
List<Result> results = new ArrayList<>();
|
||||||
for (File imageFile : testImageGroup.getValue()) {
|
for (File imageFile : testImageGroup.getValue()) {
|
||||||
BufferedImage image = ImageIO.read(imageFile);
|
BufferedImage image = ImageIO.read(imageFile);
|
||||||
float rotation = testResults.get(x).getRotation();
|
float rotation = testResults.get(x).getRotation();
|
||||||
|
@ -211,7 +211,7 @@ public final class PDF417BlackBox4TestCase extends AbstractBlackBoxTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Result[] decode(BinaryBitmap source, boolean tryHarder) throws ReaderException {
|
private Result[] decode(BinaryBitmap source, boolean tryHarder) throws ReaderException {
|
||||||
Map<DecodeHintType,Object> hints = new EnumMap<DecodeHintType,Object>(DecodeHintType.class);
|
Map<DecodeHintType,Object> hints = new EnumMap<>(DecodeHintType.class);
|
||||||
if (tryHarder) {
|
if (tryHarder) {
|
||||||
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
|
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
@ -220,13 +220,13 @@ public final class PDF417BlackBox4TestCase extends AbstractBlackBoxTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String,List<File>> getImageFileLists() {
|
private Map<String,List<File>> getImageFileLists() {
|
||||||
Map<String,List<File>> result = new HashMap<String,List<File>>();
|
Map<String,List<File>> result = new HashMap<>();
|
||||||
for (File file : getImageFiles()) {
|
for (File file : getImageFiles()) {
|
||||||
String testImageFileName = file.getName();
|
String testImageFileName = file.getName();
|
||||||
String fileBaseName = testImageFileName.substring(0, testImageFileName.indexOf('-'));
|
String fileBaseName = testImageFileName.substring(0, testImageFileName.indexOf('-'));
|
||||||
List<File> files = result.get(fileBaseName);
|
List<File> files = result.get(fileBaseName);
|
||||||
if (files == null) {
|
if (files == null) {
|
||||||
files = new ArrayList<File>();
|
files = new ArrayList<>();
|
||||||
result.put(fileBaseName, files);
|
result.put(fileBaseName, files);
|
||||||
}
|
}
|
||||||
files.add(file);
|
files.add(file);
|
||||||
|
|
|
@ -110,7 +110,7 @@ public final class QRCodeWriterTestCase extends Assert {
|
||||||
BitMatrix goldenResult = createMatrixFromImage(image);
|
BitMatrix goldenResult = createMatrixFromImage(image);
|
||||||
assertNotNull(goldenResult);
|
assertNotNull(goldenResult);
|
||||||
|
|
||||||
Map<EncodeHintType,Object> hints = new EnumMap<EncodeHintType,Object>(EncodeHintType.class);
|
Map<EncodeHintType,Object> hints = new EnumMap<>(EncodeHintType.class);
|
||||||
hints.put(EncodeHintType.ERROR_CORRECTION, ecLevel);
|
hints.put(EncodeHintType.ERROR_CORRECTION, ecLevel);
|
||||||
QRCodeWriter writer = new QRCodeWriter();
|
QRCodeWriter writer = new QRCodeWriter();
|
||||||
BitMatrix generatedResult = writer.encode(contents, BarcodeFormat.QR_CODE, resolution,
|
BitMatrix generatedResult = writer.encode(contents, BarcodeFormat.QR_CODE, resolution,
|
||||||
|
|
|
@ -129,7 +129,7 @@ public final class EncoderTestCase extends Assert {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleUTF8ECI() throws WriterException {
|
public void testSimpleUTF8ECI() throws WriterException {
|
||||||
Map<EncodeHintType,Object> hints = new EnumMap<EncodeHintType, Object>(EncodeHintType.class);
|
Map<EncodeHintType,Object> hints = new EnumMap<>(EncodeHintType.class);
|
||||||
hints.put(EncodeHintType.CHARACTER_SET, "UTF8");
|
hints.put(EncodeHintType.CHARACTER_SET, "UTF8");
|
||||||
QRCode qrCode = Encoder.encode("hello", ErrorCorrectionLevel.H, hints);
|
QRCode qrCode = Encoder.encode("hello", ErrorCorrectionLevel.H, hints);
|
||||||
String expected =
|
String expected =
|
||||||
|
|
|
@ -120,19 +120,6 @@
|
||||||
<version>3.0.0-SNAPSHOT</version>
|
<version>3.0.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<source>7</source>
|
|
||||||
<target>7</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<name>ZXing Google Glass Mirror API app</name>
|
<name>ZXing Google Glass Mirror API app</name>
|
||||||
<description>Experimental Barcode Scanner app for Google Glass Mirror API</description>
|
<description>Experimental Barcode Scanner app for Google Glass Mirror API</description>
|
||||||
|
|
||||||
|
|
|
@ -35,19 +35,6 @@
|
||||||
<version>3.0.0-SNAPSHOT</version>
|
<version>3.0.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<source>7</source>
|
|
||||||
<target>7</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<name>ZXing Java SE extensions</name>
|
<name>ZXing Java SE extensions</name>
|
||||||
<description>Java SE-specific extensions to core ZXing library</description>
|
<description>Java SE-specific extensions to core ZXing library</description>
|
||||||
|
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -105,8 +105,8 @@
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.1</version>
|
<version>3.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>6</source>
|
<source>7</source>
|
||||||
<target>6</target>
|
<target>7</target>
|
||||||
<compilerArgs>
|
<compilerArgs>
|
||||||
<arg>-Xlint:all</arg>
|
<arg>-Xlint:all</arg>
|
||||||
</compilerArgs>
|
</compilerArgs>
|
||||||
|
|
|
@ -48,14 +48,6 @@
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<source>7</source>
|
|
||||||
<target>7</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>gwt-maven-plugin</artifactId>
|
<artifactId>gwt-maven-plugin</artifactId>
|
||||||
|
|
|
@ -67,14 +67,6 @@
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<source>7</source>
|
|
||||||
<target>7</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-dependency-plugin</artifactId>
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
|
Loading…
Reference in a new issue