mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 12:46:45 +00:00
for zbar scans, return scanned characters as raw bytes
This commit is contained in:
parent
7ff4230e13
commit
4b6a03ef56
2 changed files with 12 additions and 2 deletions
2
drongo
2
drongo
|
@ -1 +1 @@
|
|||
Subproject commit e15eb7c7f36756c35577d61bfd793b2a2502cf93
|
||||
Subproject commit d7b97c99dcd1aa593e7c4354652cd8068aaaeccb
|
|
@ -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) {}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue