2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.netconf.confignetconfconnector.mapping.attributes.fromxml;
11 import com.google.common.collect.Lists;
12 import com.google.common.io.BaseEncoding;
14 import java.util.List;
16 public class SimpleBinaryAttributeReadingStrategy extends SimpleAttributeReadingStrategy {
18 public SimpleBinaryAttributeReadingStrategy(String nullableDefault) {
19 super(nullableDefault);
23 protected Object postprocessParsedValue(String textContent) {
24 BaseEncoding en = BaseEncoding.base64();
25 byte[] decode = en.decode(textContent);
26 List<String> parsed = Lists.newArrayListWithCapacity(decode.length);
27 for (byte b : decode) {
28 parsed.add(Byte.toString(b));
34 protected Object postprocessNullableDefault(String nullableDefault) {
35 return nullableDefault == null ? null : postprocessParsedValue(nullableDefault);