Logging vCard content received to help debug

git-svn-id: https://zxing.googlecode.com/svn/trunk@1117 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2009-11-22 05:59:00 +00:00
parent 2893fb3804
commit c0c1290611

View file

@ -42,6 +42,7 @@ import android.util.Log;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
/**
* This class does the work of decoding the user's request and extracting all the data
@ -50,13 +51,16 @@ import java.io.InputStream;
* @author dswitkin@google.com (Daniel Switkin)
*/
final class QRCodeEncoder {
private static final String TAG = "QRCodeEncoder";
private final Activity activity;
private String contents;
private String displayContents;
private String title;
private BarcodeFormat format;
public QRCodeEncoder(Activity activity, Intent intent) {
QRCodeEncoder(Activity activity, Intent intent) {
this.activity = activity;
if (intent == null) {
throw new IllegalArgumentException("No valid data to encode.");
@ -69,7 +73,7 @@ final class QRCodeEncoder {
}
} else if (action.equals(Intent.ACTION_SEND)) {
if (!encodeContentsFromShareIntent(intent)) {
throw new IllegalArgumentException("No valid data to encode.");
throw new IllegalArgumentException("No valid data to encode.");
}
}
}
@ -142,7 +146,8 @@ final class QRCodeEncoder {
int length = stream.available();
byte[] vcard = new byte[length];
stream.read(vcard, 0, length);
String vcardString = new String(vcard, "utf-8");
String vcardString = new String(vcard, Charset.forName("UTF-8"));
Log.d(TAG, "Encoding share intent content: " + vcardString);
Result result = new Result(vcardString, vcard, null, BarcodeFormat.QR_CODE);
ParsedResult parsedResult = ResultParser.parseResult(result);
if (!(parsedResult instanceof AddressBookParsedResult)) {