All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.darwinsys.preso.QRFormatter Maven / Gradle / Ivy

There is a newer version: 1.8.0
Show newest version
package com.darwinsys.preso;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

public class QRFormatter {

	private static int SIZE = 128;

	public static String format(String url) {
		String encodedURL = url;
		try {
			encodedURL = URLEncoder.encode(url, "UTF-8");
		} catch (UnsupportedEncodingException e) {
			System.out.println("GOOFY! " + e);	// CANTHAPPEN
		}
		return String.format(
			"http://chart.apis.google.com/chart?cht=qr&chs=%d&chl=%s",
			SIZE, encodedURL);
	}

	public int getWidth() {
		return SIZE;
	}

	public int getHeight() {
		return SIZE;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy