@Test public void testResizeImage() throws Throwable { BufferedImage in = myClassUnderTest.convert( JPG_HEX_DUMP ); BufferedImage actual = ConverterImage.resizeImage( in, 200, 200 ); myLog.debug( actual ); Assert.assertNotNull( actual ); File out = new File( "resized.jpg" ); Assert.assertTrue( ImageIO.write( actual, "JPG", out ) ); Assert.assertTrue( out.exists() ); Assert.assertTrue( out.delete() ); }
@Override public BufferedImage convert( String aValue ) throws SdiException { if ( !StringUtils.hasText( aValue ) ) { myLog.debug( "Given value is null" ); return null; } byte[] binary; try { binary = Hex.decodeHex( aValue.toCharArray() ); } catch ( DecoderException t ) { throw new SdiException( "Cannot convert input value to binary array: " + aValue, t, SdiException.EXIT_CODE_PARSE_ERROR ); } ByteArrayInputStream bais = new ByteArrayInputStream( binary ); return super.convert( bais ); }
ConverterJpgFromHexDump extends ConverterImage { @Override public BufferedImage convert( String aValue ) throws SdiException { if ( !StringUtils.hasText( aValue ) ) { myLog.debug( "Given value is null" ); return null; } byte[] binary; try { binary = Hex.decodeHex( aValue.toCharArray() ); } catch ( DecoderException t ) { throw new SdiException( "Cannot convert input value to binary array: " + aValue, t, SdiException.EXIT_CODE_PARSE_ERROR ); } ByteArrayInputStream bais = new ByteArrayInputStream( binary ); return super.convert( bais ); } }
ConverterJpgFromHexDump extends ConverterImage { @Override public BufferedImage convert( String aValue ) throws SdiException { if ( !StringUtils.hasText( aValue ) ) { myLog.debug( "Given value is null" ); return null; } byte[] binary; try { binary = Hex.decodeHex( aValue.toCharArray() ); } catch ( DecoderException t ) { throw new SdiException( "Cannot convert input value to binary array: " + aValue, t, SdiException.EXIT_CODE_PARSE_ERROR ); } ByteArrayInputStream bais = new ByteArrayInputStream( binary ); return super.convert( bais ); }  }
ConverterJpgFromHexDump extends ConverterImage { @Override public BufferedImage convert( String aValue ) throws SdiException { if ( !StringUtils.hasText( aValue ) ) { myLog.debug( "Given value is null" ); return null; } byte[] binary; try { binary = Hex.decodeHex( aValue.toCharArray() ); } catch ( DecoderException t ) { throw new SdiException( "Cannot convert input value to binary array: " + aValue, t, SdiException.EXIT_CODE_PARSE_ERROR ); } ByteArrayInputStream bais = new ByteArrayInputStream( binary ); return super.convert( bais ); }  @Override FieldConverter<BufferedImage> init( Environment aEnv, String aFieldname ); @Override BufferedImage convert( String aValue ); }
ConverterJpgFromHexDump extends ConverterImage { @Override public BufferedImage convert( String aValue ) throws SdiException { if ( !StringUtils.hasText( aValue ) ) { myLog.debug( "Given value is null" ); return null; } byte[] binary; try { binary = Hex.decodeHex( aValue.toCharArray() ); } catch ( DecoderException t ) { throw new SdiException( "Cannot convert input value to binary array: " + aValue, t, SdiException.EXIT_CODE_PARSE_ERROR ); } ByteArrayInputStream bais = new ByteArrayInputStream( binary ); return super.convert( bais ); }  @Override FieldConverter<BufferedImage> init( Environment aEnv, String aFieldname ); @Override BufferedImage convert( String aValue ); static final String CONVERTER_NAME; }