Codota Logo
net.glxn.qrgen
Code IndexAdd Codota to your IDE (free)

How to use net.glxn.qrgen

Best Java code snippets using net.glxn.qrgen (Showing top 13 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Gson g =
  • Codota Iconnew Gson()
  • Codota IconGsonBuilder gsonBuilder;gsonBuilder.create()
  • Codota Iconnew GsonBuilder().create()
  • Smart code suggestions by Codota
}
origin: primefaces/primefaces

@Override
public void handle(FacesContext context) throws IOException {
  Map<String, String> params = context.getExternalContext().getRequestParameterMap();
  ExternalContext externalContext = context.getExternalContext();
  String sessionKey = params.get(Constants.DYNAMIC_CONTENT_PARAM);
  Map<String, Object> session = externalContext.getSessionMap();
  Map<String, String> barcodeMapping = (Map) session.get(Constants.BARCODE_MAPPING);
  String value = barcodeMapping.get(sessionKey);
  if (value != null) {
    boolean cache = Boolean.parseBoolean(params.get(Constants.DYNAMIC_CONTENT_CACHE_PARAM));
    externalContext.setResponseStatus(200);
    externalContext.setResponseContentType("image/png");
    handleCache(externalContext, cache);
    ErrorCorrectionLevel ecl = ErrorCorrectionLevel.L;
    String errorCorrection = params.get("qrec");
    if (!LangUtils.isValueBlank(errorCorrection)) {
      ecl = ErrorCorrectionLevel.valueOf(errorCorrection);
    }
    QRCode.from(value).to(ImageType.PNG).withErrorCorrection(ecl).withCharset("UTF-8")
          .writeTo(externalContext.getResponseOutputStream());
    externalContext.responseFlushBuffer();
    context.responseComplete();
  }
}
origin: winder/Universal-G-Code-Sender

  !hostAddress.equals("127.0.0.1")){
String url = "http://"+hostAddress+":"+port;
ByteArrayOutputStream bout = QRCode.from(url).to(ImageType.PNG).stream();
out.add(new PendantURLBean(url, bout.toByteArray()));
System.out.println("Listening on: "+url);
origin: net.glxn/qrgen

/**
 * Overrides the default error correction by supplying a {@link com.google.zxing.EncodeHintType#ERROR_CORRECTION} hint to
 * {@link com.google.zxing.qrcode.QRCodeWriter#encode}
 *
 * @return the current QRCode object
 */
public QRCode withErrorCorrection(ErrorCorrectionLevel level) {
  return withHint(EncodeHintType.ERROR_CORRECTION, level);
}
origin: pwm-project/pwm

try
  imageBytes = QRCode.from( qrCodeContent )
      .withCharset( PwmConstants.DEFAULT_CHARSET.toString() )
      .withSize( width, height )
      .stream()
      .toByteArray();
origin: net.glxn/qrgen

/**
 * returns a {@link File} representation of the QR code. The file is set to be deleted on exit (i.e. {@link
 * java.io.File#deleteOnExit()}). If you want the file to live beyond the life of the jvm process, you should make a copy.
 *
 * @return qrcode as file
 */
public File file() {
  File file;
  try {
    file = createTempFile();
    MatrixToImageWriter.writeToPath(createMatrix(), imageType.toString(), file.toPath());
  } catch (Exception e) {
    throw new QRGenerationException("Failed to create QR image from text due to underlying exception", e);
  }
  return file;
}
origin: net.glxn/qrgen

/**
 * writes a representation of the QR code to the supplied  {@link OutputStream}
 *
 * @param stream the {@link OutputStream} to write QR Code to
 */
public void writeTo(OutputStream stream) {
  try {
    writeToStream(stream);
  } catch (Exception e) {
    throw new QRGenerationException("Failed to create QR image from text due to underlying exception", e);
  }
}
origin: net.glxn/qrgen

/**
 * Creates a a QR Code from the given {@link VCard}.
 * <p/>
 * The QRCode will have the following defaults:     <br/> {size: 100x100}<br/>{imageType:PNG}  <br/><br/>
 *
 * @param vcard the vcard to encode as QRCode
 * @return the QRCode object
 */
public static QRCode from(VCard vcard) {
  return new QRCode(vcard.toString());
}
origin: net.glxn/qrgen

private void writeToStream(OutputStream stream) throws IOException, WriterException {
  MatrixToImageWriter.writeToStream(createMatrix(), imageType.toString(), stream);
}
origin: net.glxn/qrgen

/**
 * Create a QR code from the given text.    <br/><br/>
 * <p/>
 * There is a size limitation to how much you can put into a QR code. This has been tested to work with up to a length of 2950
 * characters.<br/><br/>
 * <p/>
 * The QRCode will have the following defaults:     <br/> {size: 100x100}<br/>{imageType:PNG}  <br/><br/>
 * <p/>
 * Both size and imageType can be overridden:   <br/> Image type override is done by calling {@link
 * QRCode#to(net.glxn.qrgen.image.ImageType)} e.g. QRCode.from("hello world").to(JPG) <br/> Size override is done by calling
 * {@link QRCode#withSize} e.g. QRCode.from("hello world").to(JPG).withSize(125, 125)  <br/>
 *
 * @param text the text to encode to a new QRCode, this may fail if the text is too large. <br/>
 * @return the QRCode object    <br/>
 */
public static QRCode from(String text) {
  return new QRCode(text);
}
origin: org.primefaces/primefaces

public void handle(FacesContext context) throws IOException {
  Map<String, String> params = context.getExternalContext().getRequestParameterMap();
  ExternalContext externalContext = context.getExternalContext();
  String sessionKey = (String) params.get(Constants.DYNAMIC_CONTENT_PARAM);
  Map<String, Object> session = externalContext.getSessionMap();
  Map<String, String> barcodeMapping = (Map) session.get(Constants.BARCODE_MAPPING);
  String value = barcodeMapping.get(sessionKey);
  if (value != null) {
    boolean cache = Boolean.valueOf(params.get(Constants.DYNAMIC_CONTENT_CACHE_PARAM));
    externalContext.setResponseStatus(200);
    externalContext.setResponseContentType("image/png");
    handleCache(externalContext, cache);
    ErrorCorrectionLevel ecl = ErrorCorrectionLevel.L;
    String errorCorrection = params.get("qrec");
    if (!ComponentUtils.isValueBlank(errorCorrection)) {
      ecl = ErrorCorrectionLevel.valueOf(errorCorrection);
    }
    QRCode.from(value).to(ImageType.PNG).withErrorCorrection(ecl).withCharset("UTF-8")
          .writeTo(externalContext.getResponseOutputStream());
    externalContext.responseFlushBuffer();
    context.responseComplete();
  }
}
origin: net.glxn/qrgen

/**
 * returns a {@link File} representation of the QR code. The file has the given name. The file is set to be deleted on exit
 * (i.e. {@link java.io.File#deleteOnExit()}). If you want the file to live beyond the life of the jvm process, you should
 * make a copy.
 *
 * @param name name of the created file
 * @return qrcode as file
 * @see #file()
 */
public File file(String name) {
  File file;
  try {
    file = createTempFile(name);
    MatrixToImageWriter.writeToPath(createMatrix(), imageType.toString(), file.toPath());
  } catch (Exception e) {
    throw new QRGenerationException("Failed to create QR image from text due to underlying exception", e);
  }
  return file;
}
origin: net.glxn/qrgen

/**
 * returns a {@link ByteArrayOutputStream} representation of the QR code
 *
 * @return qrcode as stream
 */
public ByteArrayOutputStream stream() {
  ByteArrayOutputStream stream = new ByteArrayOutputStream();
  try {
    writeToStream(stream);
  } catch (Exception e) {
    throw new QRGenerationException("Failed to create QR image from text due to underlying exception", e);
  }
  return stream;
}
origin: net.glxn/qrgen

/**
 * Overrides the default charset by supplying a {@link com.google.zxing.EncodeHintType#CHARACTER_SET} hint to {@link
 * com.google.zxing.qrcode.QRCodeWriter#encode}
 *
 * @return the current QRCode object
 */
public QRCode withCharset(String charset) {
  return withHint(EncodeHintType.CHARACTER_SET, charset);
}
net.glxn.qrgen

Most used classes

  • QRCode
  • QRGenerationException
  • ImageType
  • Schema
    Abstract schema class
  • QRCode
  • AbstractQRCode,
  • Wifi,
  • BizCard,
  • Bookmark,
  • EMail,
  • EnterpriseWifi,
  • ExtendableQRCodeSchemeParser$QRCodeSchemeParserImpl,
  • ExtendableQRCodeSchemeParser,
  • GeoInfo,
  • Girocode$Encoding,
  • Girocode,
  • GooglePlay,
  • ICal,
  • IEvent
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now