Package org.daisy.braille.embosser
Class EmbosserTools
java.lang.Object
org.daisy.braille.embosser.EmbosserTools
Provides tools related to embosser communication.
- Author:
- Joel HÃ¥kansson
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
getHeight
(Dimensions dim, double unit) Get height, in unitsstatic int
getWidth
(Dimensions dim, double unit) Get width, in unitsstatic byte[]
toBytes
(int val, int size) Converts an integer to bytes and padding the value with zeros to the required size.
-
Field Details
-
INCH_IN_MM
public static final double INCH_IN_MMNumber of mm/inch- See Also:
-
-
Constructor Details
-
EmbosserTools
public EmbosserTools()
-
-
Method Details
-
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 by size.
-
getWidth
Get width, in units- Parameters:
unit
- unit in mm- Returns:
- returns width in units
-
getHeight
Get height, in units- Parameters:
unit
- unit in mm- Returns:
- returns width in units
-