mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2026-08-10 08:37:05 +00:00
for zbar scans, return scanned characters as raw bytes
This commit is contained in:
@@ -49,7 +49,7 @@ public class ZBar {
|
||||
Scan scan = null;
|
||||
for(Iterator<Symbol> iter = results.iterator(); iter.hasNext(); ) {
|
||||
try(Symbol symbol = iter.next()) {
|
||||
scan = new Scan(symbol.getDataBytes(), symbol.getData());
|
||||
scan = new Scan(getRawBytes(symbol.getData()), symbol.getData());
|
||||
}
|
||||
}
|
||||
return scan;
|
||||
@@ -122,5 +122,15 @@ public class ZBar {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static byte[] getRawBytes(String str) {
|
||||
char[] chars = str.toCharArray();
|
||||
byte[] bytes = new byte[chars.length];
|
||||
for(int i = 0; i < chars.length; i++) {
|
||||
bytes[i] = (byte)(chars[i]);
|
||||
}
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public record Scan(byte[] rawData, String stringData) {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user