Class EmbosserTools
- java.lang.Object
-
- org.daisy.braille.utils.impl.tools.embosser.EmbosserTools
-
public class EmbosserTools extends Object
Provides tools related to embosser communication.
-
-
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.
-
-
-
Field Detail
-
INCH_IN_MM
public static final double INCH_IN_MM
Number of mm/inch.- See Also:
- Constant Field Values
-
-
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 convertsize
- the number of bytes to output- Returns:
- returns a zero padded byte array containing the value
- Throws:
IllegalArgumentException
- if the integer value requires more bytes than specified bysize
.
-
getWidth
public static int getWidth(Dimensions dim, double unit)
Get width, in units.- Parameters:
dim
- the dimensionsunit
- unit in mm- Returns:
- returns width in units
-
getHeight
public static int getHeight(Dimensions dim, double unit)
Get height, in units.- Parameters:
dim
- the dimensionsunit
- unit in mm- Returns:
- returns width in units
-
-