2 * Copyright (c) 2015 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.config.facade.xml.mapping.attributes.fromxml;
11 import com.google.common.collect.Lists;
12 import com.google.common.io.BaseEncoding;
13 import java.util.List;
15 public class SimpleBinaryAttributeReadingStrategy extends SimpleAttributeReadingStrategy {
17 public SimpleBinaryAttributeReadingStrategy(final String nullableDefault) {
18 super(nullableDefault);
22 protected Object postprocessParsedValue(final 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(final String nullableDefault) {
34 return nullableDefault == null ? null : postprocessParsedValue(nullableDefault);