StringUtf8Coder.java 文件源码

java
阅读 23 收藏 0 点赞 0 评论 0

项目:beam 作者:
@Override
public String decode(InputStream inStream, Context context)
    throws IOException {
  if (context.isWholeStream) {
    byte[] bytes = StreamUtils.getBytes(inStream);
    return new String(bytes, StandardCharsets.UTF_8);
  } else {
    try {
      return readString(new DataInputStream(inStream));
    } catch (EOFException | UTFDataFormatException exn) {
      // These exceptions correspond to decoding problems, so change
      // what kind of exception they're branded as.
      throw new CoderException(exn);
    }
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号