doulu4316
doulu4316
2013-05-09 05:45

如何在StreamWriter中使用Close()方法

In Go crypto\cipher package, type StreamWriter has a Close() method. From the implementation, it looks like just calling the underlying io.Writer's Close() method. My question is: is there any scenario that I should call this method instead of calling the Close() method of the underlying Writer directly?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • dongshiqin1352 dongshiqin1352 8年前

    No, calling StreamWriter's close method and calling the underlying writer's close method is exactly the same. It is only there so StreamWriter will implement the io.WriteCloser interface.

    It is only because this method exists that the type can be used as an io.WriteCloser.

    点赞 评论 复制链接分享

为你推荐