Skip to content

Commit 3938b61

Browse files
committed
added unformatted bytearray adapter
1 parent 084b405 commit 3938b61

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* ModifiableVariable - A Variable Concept for Runtime Modifications
3+
*
4+
* Copyright 2014-2017 Ruhr University Bochum / Hackmanit GmbH
5+
*
6+
* Licensed under Apache License 2.0
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*/
9+
package de.rub.nds.modifiablevariable.util;
10+
11+
import javax.xml.bind.annotation.adapters.XmlAdapter;
12+
13+
/**
14+
*
15+
*/
16+
public class UnformattedByteArrayAdapter extends XmlAdapter<String, byte[]> {
17+
18+
@Override
19+
public byte[] unmarshal(String value) {
20+
21+
value = value.replaceAll("\\s", "");
22+
return ArrayConverter.hexStringToByteArray(value);
23+
}
24+
25+
@Override
26+
public String marshal(byte[] value) {
27+
return ArrayConverter.bytesToHexString(value, false, false);
28+
}
29+
}

0 commit comments

Comments
 (0)