1
2
3
4
5
6
7
8
9
10
11 package org.csveed.bean.conversion;
12
13 import java.nio.charset.Charset;
14
15
16
17
18 public class ByteArrayConverter extends AbstractConverter<byte[]> {
19
20
21
22
23 public ByteArrayConverter() {
24 super(byte[].class);
25 }
26
27 @Override
28 public byte[] fromString(String text) throws Exception {
29 return text != null ? text.getBytes(Charset.defaultCharset()) : null;
30 }
31
32 @Override
33 public String toString(byte[] value) throws Exception {
34 return value != null ? new String(value, Charset.defaultCharset()) : "";
35 }
36 }