Class EmbosserTools


  • public class EmbosserTools
    extends java.lang.Object
    Provides tools related to embosser communication.
    Author:
    Joel HÃ¥kansson
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static double INCH_IN_MM
      Number of mm/inch
    • Constructor Summary

      Constructors 
      Constructor Description
      EmbosserTools()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int getHeight​(Dimensions dim, double unit)
      Get height, in units
      static int getWidth​(Dimensions dim, double unit)
      Get width, in units
      static byte[] toBytes​(int val, int size)
      Converts an integer to bytes and padding the value with zeros to the required size.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EmbosserTools

        public EmbosserTools()
    • Method Detail

      • toBytes

        public static byte[] toBytes​(int val,
                                     int size)
        Converts an integer to bytes and padding the value with zeros to the required size.
        Parameters:
        val - the value to convert
        size - the number of bytes to output
        Returns:
        returns a zero padded byte array containing the value
        Throws:
        java.lang.IllegalArgumentException - if the integer value requires more bytes than specified by size.
      • getWidth

        public static int getWidth​(Dimensions dim,
                                   double unit)
        Get width, in units
        Parameters:
        unit - unit in mm
        Returns:
        returns width in units
      • getHeight

        public static int getHeight​(Dimensions dim,
                                    double unit)
        Get height, in units
        Parameters:
        unit - unit in mm
        Returns:
        returns width in units