Class DataTooLongException

All Implemented Interfaces:

public class DataTooLongException
extends java.lang.IllegalArgumentException
Thrown when the supplied data does not fit any QR Code version. Ways to handle this exception include:
  • Decrease the error correction level if it was greater than Ecc.LOW.

  • If the advanced encodeSegments() function with 6 arguments or the makeSegmentsOptimally() function was called, then increase the maxVersion argument if it was less than QrCode.MAX_VERSION. (This advice does not apply to the other factory functions because they search all versions up to QrCode.MAX_VERSION.)

  • Split the text data into better or optimal segments in order to reduce the number of bits required. (See QrSegmentAdvanced.makeSegmentsOptimally().)

  • Change the text or binary data to be shorter.

  • Change the text to fit the character set of a particular segment mode (e.g. alphanumeric).

  • Propagate the error upward to the caller/user.

See Also:
QrCode.encodeText(String, QrCode.Ecc), QrCode.encodeBinary(byte[], QrCode.Ecc), QrCode.encodeSegments(java.util.List, QrCode.Ecc), QrCode.encodeSegments(java.util.List, QrCode.Ecc, int, int, int, boolean), QrSegmentAdvanced.makeSegmentsOptimally(String, QrCode.Ecc, int, int), Serialized Form
  • Constructor Summary

    Constructor Description
    DataTooLongException​(java.lang.String msg)  
  • Method Summary

    Methods inherited from class java.lang.Throwable

    addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DataTooLongException

      public DataTooLongException()
    • DataTooLongException

      public DataTooLongException​(java.lang.String msg)