*/
package org.opendaylight.controller.blueprint.ext;
-import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableList;
import com.google.common.io.Resources;
import java.io.IOException;
import java.net.URL;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
LOG.debug("{}: Found {} resource in bundle {}", logName(), resource, bundle.getSymbolicName());
try {
- for(String line : Resources.readLines(resource, Charsets.UTF_8)) {
+ for(String line : Resources.readLines(resource, StandardCharsets.UTF_8)) {
int ci = line.indexOf('#');
if(ci >= 0) {
line = line.substring(0, ci);
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
-
+import java.nio.charset.StandardCharsets;
import java.util.List;
-import com.google.common.base.Charsets;
-
/**
*
*/
public class SimpleByteToMessageDecoder extends ByteToMessageDecoder {
@Override
protected void decode(final ChannelHandlerContext ctx, final ByteBuf in, final List<Object> out) {
- out.add(new SimpleMessage(Charsets.UTF_8.decode(in.nioBuffer()).toString()));
+ out.add(new SimpleMessage(StandardCharsets.UTF_8.decode(in.nioBuffer()).toString()));
}
}
package org.opendaylight.controller.config.facade.xml.osgi;
-import com.google.common.base.Charsets;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.collect.BiMap;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.SoftReference;
+import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
try {
final YangTextSchemaSource yangTextSchemaSource = source.checkedGet();
try(InputStream inStream = yangTextSchemaSource.openStream()) {
- return new String(ByteStreams.toByteArray(inStream), Charsets.UTF_8);
+ return new String(ByteStreams.toByteArray(inStream), StandardCharsets.UTF_8);
}
} catch (SchemaSourceException | IOException e) {
LOG.warn("Unable to provide source for {}", moduleIdentifier, e);
import static java.lang.String.format;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Charsets;
import com.google.common.io.Resources;
import java.io.IOException;
import java.net.URL;
+import java.nio.charset.StandardCharsets;
import org.opendaylight.controller.config.spi.ModuleFactory;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleEvent;
bundle, resource, event);
if (resource != null) {
try {
- for (String factoryClassName : Resources.readLines(resource, Charsets.UTF_8)) {
+ for (String factoryClassName : Resources.readLines(resource, StandardCharsets.UTF_8)) {
registerFactory(factoryClassName, bundle);
}
package org.opendaylight.controller.config.manager.impl.osgi.mapping;
import static java.lang.String.format;
-import com.google.common.base.Charsets;
import com.google.common.io.Resources;
import java.io.IOException;
import java.net.URL;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
+import java.nio.charset.StandardCharsets;
import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.opendaylight.yangtools.yang.binding.YangModelBindingProvider;
import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
List<ObjectRegistration<YangModuleInfo>> registrations = new LinkedList<>();
try {
- for (String moduleInfoName : Resources.readLines(resource, Charsets.UTF_8)) {
+ for (String moduleInfoName : Resources.readLines(resource, StandardCharsets.UTF_8)) {
LOG.trace("Retrieve ModuleInfo({}, {})", moduleInfoName, bundle);
YangModuleInfo moduleInfo = retrieveModuleInfo(moduleInfoName, bundle);
registrations.add(moduleInfoRegistry.registerModuleInfo(moduleInfo));
*/
package org.opendaylight.controller.config.persist.storage.file.xml.model;
-import com.google.common.base.Charsets;
import com.google.common.base.Optional;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.io.Files;
import java.io.File;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
private static boolean isBlank(File from) {
try {
- return StringUtils.isBlank(Files.toString(from, Charsets.UTF_8));
+ return StringUtils.isBlank(Files.toString(from, StandardCharsets.UTF_8));
} catch (IOException e) {
throw new IllegalStateException("Unexpected error reading file" + from, e);
}
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
-import com.google.common.base.Charsets;
import com.google.common.collect.Sets;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.file.Files;
+import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
if (!file.exists()) {
return;
}
- com.google.common.io.Files.write("", file, Charsets.UTF_8);
+ com.google.common.io.Files.write("", file, StandardCharsets.UTF_8);
i = 1;
storage = new XmlFileStorageAdapter();
}
storage.persistConfig(holder);
- assertEquals(29, com.google.common.io.Files.readLines(file, Charsets.UTF_8).size());
+ assertEquals(29, com.google.common.io.Files.readLines(file, StandardCharsets.UTF_8).size());
List<ConfigSnapshotHolder> lastConf = storage.loadLastConfigs();
assertEquals(1, lastConf.size());
ConfigSnapshotHolder configSnapshotHolder = lastConf.get(0);
storage.persistConfig(holder);
- assertEquals(29, com.google.common.io.Files.readLines(file, Charsets.UTF_8).size());
+ assertEquals(29, com.google.common.io.Files.readLines(file, StandardCharsets.UTF_8).size());
List<ConfigSnapshotHolder> lastConf = storage.loadLastConfigs();
assertEquals(1, lastConf.size());
storage.setFeaturesService(mock);
storage.persistConfig(holder);
- assertEquals(20, com.google.common.io.Files.readLines(file, Charsets.UTF_8).size());
+ assertEquals(20, com.google.common.io.Files.readLines(file, StandardCharsets.UTF_8).size());
List<ConfigSnapshotHolder> lastConf = storage.loadLastConfigs();
assertEquals(1, lastConf.size());
" </configuration>\n" +
" </snapshot>\n" +
" </snapshots>\n" +
- "</persisted-snapshots>", file, Charsets.UTF_8);
+ "</persisted-snapshots>", file, StandardCharsets.UTF_8);
List<ConfigSnapshotHolder> lastConf = storage.loadLastConfigs();
assertEquals(1, lastConf.size());
storage.persistConfig(holder);
storage.persistConfig(holder);
- List<String> readLines = com.google.common.io.Files.readLines(file, Charsets.UTF_8);
+ List<String> readLines = com.google.common.io.Files.readLines(file, StandardCharsets.UTF_8);
assertEquals(29, readLines.size());
List<ConfigSnapshotHolder> lastConf = storage.loadLastConfigs();
import static org.junit.Assert.assertEquals;
-import com.google.common.base.Charsets;
import com.google.common.collect.Sets;
import com.google.common.io.Resources;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.HashSet;
import java.util.Set;
import org.junit.Test;
}
private Set<String> readLines(String fileName) throws IOException {
- return new HashSet<>(Resources.readLines(getClass().getResource(fileName), Charsets.UTF_8));
+ return new HashSet<>(Resources.readLines(getClass().getResource(fileName), StandardCharsets.UTF_8));
}
private String readToString(String fileName) throws IOException {
- return Resources.toString(getClass().getResource(fileName), Charsets.UTF_8);
+ return Resources.toString(getClass().getResource(fileName), StandardCharsets.UTF_8);
}
}
package org.opendaylight.controller.config.util.xml;
-import com.google.common.base.Charsets;
import com.google.common.base.Optional;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
+import java.nio.charset.StandardCharsets;
import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
}
public static Document readXmlToDocument(final String xmlContent) throws SAXException, IOException {
- return readXmlToDocument(new ByteArrayInputStream(xmlContent.getBytes(Charsets.UTF_8)));
+ return readXmlToDocument(new ByteArrayInputStream(xmlContent.getBytes(StandardCharsets.UTF_8)));
}
// TODO improve exceptions throwing