package com.google.zxing.client.result;
+import com.google.zxing.Result;
+
import java.util.Vector;
/**
this.address = address;
}
- public static AddressBookAUResult parse(String rawText) {
+ public static AddressBookAUResult parse(Result result) {
+ String rawText = result.getText();
// MEMORY is mandatory; seems like a decent indicator, as does end-of-record separator CR/LF
if (rawText.indexOf("MEMORY") < 0 || rawText.indexOf("\r\n") < 0) {
return null;
package com.google.zxing.client.result;
+import com.google.zxing.Result;
+
/**
* Implements the "MECARD" address book entry format.
*
this.address = address;
}
- public static AddressBookDoCoMoResult parse(String rawText) {
+ public static AddressBookDoCoMoResult parse(Result result) {
+ String rawText = result.getText();
if (!rawText.startsWith("MECARD:")) {
return null;
}
package com.google.zxing.client.result;
+import com.google.zxing.Result;
+
/**
* @author srowen@google.com (Sean Owen)
*/
this.uri = uri;
}
- public static BookmarkDoCoMoResult parse(String rawText) {
+ public static BookmarkDoCoMoResult parse(Result result) {
+ String rawText = result.getText();
if (!rawText.startsWith("MEBKM:")) {
return null;
}
package com.google.zxing.client.result;
+import com.google.zxing.Result;
+
/**
* Represents a result that encodes an e-mail address, either as a plain address
* like "joe@example.org" or a mailto: URL like "mailto:joe@example.org".
this.emailAddress = emailAddress;
}
- public static EmailAddressResult parse(String rawText) {
+ public static EmailAddressResult parse(Result result) {
+ String rawText = result.getText();
String emailAddress;
if (rawText.startsWith("mailto:")) {
// If it starts with mailto:, assume it is definitely trying to be an email address
package com.google.zxing.client.result;
+import com.google.zxing.Result;
+
/**
* Implements the "MATMSG" email message entry format.
*
this.body = body;
}
- public static EmailDoCoMoResult parse(String rawText) {
+ public static EmailDoCoMoResult parse(Result result) {
+ String rawText = result.getText();
if (!rawText.startsWith("MATMSG:")) {
return null;
}
// This is a bit messy, but given limited options in MIDP / CLDC, this may well be the simplest
// way to go about this. For example, we have no reflection available, really.
// Order is important here.
- String rawText = theResult.getText();
ParsedReaderResult result;
- if ((result = BookmarkDoCoMoResult.parse(rawText)) != null) {
+ if ((result = BookmarkDoCoMoResult.parse(theResult)) != null) {
return result;
- } else if ((result = AddressBookDoCoMoResult.parse(rawText)) != null) {
+ } else if ((result = AddressBookDoCoMoResult.parse(theResult)) != null) {
return result;
- } else if ((result = EmailDoCoMoResult.parse(rawText)) != null) {
+ } else if ((result = EmailDoCoMoResult.parse(theResult)) != null) {
return result;
- } else if ((result = EmailAddressResult.parse(rawText)) != null) {
+ } else if ((result = EmailAddressResult.parse(theResult)) != null) {
return result;
- } else if ((result = AddressBookAUResult.parse(rawText)) != null) {
+ } else if ((result = AddressBookAUResult.parse(theResult)) != null) {
return result;
- } else if ((result = URLTOResult.parse(rawText)) != null) {
+ } else if ((result = URLTOResult.parse(theResult)) != null) {
return result;
- } else if ((result = URIParsedResult.parse(rawText)) != null) {
+ } else if ((result = URIParsedResult.parse(theResult)) != null) {
return result;
- } else if ((result = UPCParsedResult.parse(rawText)) != null) {
+ } else if ((result = UPCParsedResult.parse(theResult)) != null) {
return result;
}
- return TextParsedResult.parse(rawText);
+ return TextParsedResult.parse(theResult);
}
public String toString() {
package com.google.zxing.client.result;
+import com.google.zxing.Result;
+
/**
* @author srowen@google.com (Sean Owen)
*/
this.text = text;
}
- public static TextParsedResult parse(String rawText) {
- return new TextParsedResult(rawText);
+ public static TextParsedResult parse(Result result) {
+ return new TextParsedResult(result.getText());
}
public String getText() {
package com.google.zxing.client.result;
+import com.google.zxing.Result;
+
/**
* @author dswitkin@google.com (Daniel Switkin)
*/
this.upc = upc;
}
- public static UPCParsedResult parse(String rawText) {
+ public static UPCParsedResult parse(Result result) {
+ String rawText = result.getText();
int length = rawText.length();
if (length != 12 && length != 13) {
return null;
package com.google.zxing.client.result;
+import com.google.zxing.Result;
+
/**
* @author srowen@google.com (Sean Owen)
*/
this.uri = uri;
}
- public static URIParsedResult parse(String rawText) {
+ public static URIParsedResult parse(Result result) {
+ String rawText = result.getText();
if (!isBasicallyValidURI(rawText)) {
return null;
}
package com.google.zxing.client.result;
+import com.google.zxing.Result;
+
/**
* "URLTO" result format, which is of the form "URLTO:[title]:[url]".
* This seems to be used sometimes, but I am not able to find documentation
this.uri = uri;
}
- public static URLTOResult parse(String rawText) {
+ public static URLTOResult parse(Result result) {
+ String rawText = result.getText();
if (!rawText.startsWith("URLTO:")) {
return null;
}