Example usage for org.apache.commons.io Charsets toCharset

List of usage examples for org.apache.commons.io Charsets toCharset

Introduction

In this page you can find the example usage for org.apache.commons.io Charsets toCharset.

Prototype

public static Charset toCharset(String charset) 

Source Link

Document

Returns a Charset for the named charset.

Usage

From source file:org.apache.sling.discovery.etcd.EtcdDiscoveryService.java

@Nullable
private char[] readPwd(@Nonnull String filePath) {
    if (!isEmpty(filePath)) {
        InputStream fis = null;//from  w ww  .  jav  a2  s .c  o  m
        try {
            fis = new FileInputStream(checkFile(new File(filePath)));
            return IOUtils.toString(fis, Charsets.toCharset(UTF8)).trim().toCharArray();
        } catch (FileNotFoundException e) {
            throw wrap(e);
        } catch (IOException e) {
            throw wrap(e);
        } finally {
            IOUtils.closeQuietly(fis);
        }
    }
    return null;

}