public static PrimitiveValue parse ( final String value , final int length , final String characterEncoding ) { if ( value . length ( ) > length ) { throw new IllegalStateException ( "value.length=" + value . length ( ) + " greater than length=" + length ) ; } byte [ ] bytes = value . getBytes ( forName ( characterEncoding ) ) ; if ( bytes . length < length ) { bytes = Arrays . copyOf ( bytes , length ) ; } return new PrimitiveValue ( bytes , characterEncoding , length ) ; }
Parse constant value string and set representation based on type length and characterEncoding