Java Code Examples for java.nio.charset.UnsupportedCharsetException#toString()

The following examples show how to use java.nio.charset.UnsupportedCharsetException#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XmlParserConfig.java    From datacollector with Apache License 2.0 6 votes vote down vote up
public DataParserFactory getParserFactory(Stage.Context context) {
  DataParserFactoryBuilder builder = new DataParserFactoryBuilder(context, DataFormat.XML.getParserFormat());
  try {

    builder.setCharset(Charset.forName(charset));
  } catch (UnsupportedCharsetException ex) {
    throw new RuntimeException("It should not happen: " + ex.toString(), ex);
  }

  builder.setRemoveCtrlChars(removeCtrlChars).setMaxDataLen(-1)
      .setConfig(XmlDataParserFactory.RECORD_ELEMENT_KEY, xmlRecordElement)
      .setConfig(XmlDataParserFactory.INCLUDE_FIELD_XPATH_ATTRIBUTES_KEY, includeFieldXpathAttributes)
      .setConfig(XmlDataParserFactory.RECORD_ELEMENT_XPATH_NAMESPACES_KEY, xPathNamespaceContext)
      .setConfig(XmlDataParserFactory.USE_FIELD_ATTRIBUTES, outputFieldAttributes);
  return builder.build();
}
 
Example 2
Source File: DefaultStringifier.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public T fromString(String str) throws IOException {
  try {
    byte[] bytes = Base64.decodeBase64(str.getBytes("UTF-8"));
    inBuf.reset(bytes, bytes.length);
    T restored = deserializer.deserialize(null);
    return restored;
  } catch (UnsupportedCharsetException ex) {
    throw new IOException(ex.toString());
  }
}
 
Example 3
Source File: DefaultStringifier.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public T fromString(String str) throws IOException {
  try {
    byte[] bytes = Base64.decodeBase64(str.getBytes("UTF-8"));
    inBuf.reset(bytes, bytes.length);
    T restored = deserializer.deserialize(null);
    return restored;
  } catch (UnsupportedCharsetException ex) {
    throw new IOException(ex.toString());
  }
}
 
Example 4
Source File: DefaultStringifier.java    From RDFS with Apache License 2.0 5 votes vote down vote up
public T fromString(String str) throws IOException {
  try {
    byte[] bytes = Base64.decodeBase64(str.getBytes("UTF-8"));
    inBuf.reset(bytes, bytes.length);
    T restored = deserializer.deserialize(null);
    return restored;
  } catch (UnsupportedCharsetException ex) {
    throw new IOException(ex.toString());
  }
}
 
Example 5
Source File: DefaultStringifier.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
public T fromString(String str) throws IOException {
  try {
    byte[] bytes = Base64.decodeBase64(str.getBytes("UTF-8"));
    inBuf.reset(bytes, bytes.length);
    T restored = deserializer.deserialize(null);
    return restored;
  } catch (UnsupportedCharsetException ex) {
    throw new IOException(ex.toString());
  }
}