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);
22 protected Object postprocessParsedValue(String textContent) {
23 BaseEncoding en = BaseEncoding.base64();
24 byte[] decode = en.decode(textContent);
25 List<String> parsed = Lists.newArrayListWithCapacity(decode.length);
26 for (byte b : decode) {
27 parsed.add(Byte.toString(b));
33 protected Object postprocessNullableDefault(String nullableDefault) {
34 return nullableDefault == null ? null : postprocessParsedValue(nullableDefault);