1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-16 18:10:13 +08:00

Update io-design-patterns.md

This commit is contained in:
cxhello 2023-09-01 15:42:02 +08:00 committed by GitHub
parent 4e5f88d89d
commit d8819d365d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -215,7 +215,7 @@ static final class RunnableAdapter<T> implements Callable<T> {
工厂模式用于创建对象NIO 中大量用到了工厂模式,比如 `Files` 类的 `newInputStream` 方法用于创建 `InputStream` 对象(静态工厂)、 `Paths` 类的 `get` 方法创建 `Path` 对象(静态工厂)、`ZipFileSystem` 类(`sun.nio`包下的类,属于 `java.nio` 相关的一些内部实现)的 `getPath` 的方法创建 `Path` 对象(简单工厂)。
```java
InputStream is Files.newInputStream(Paths.get(generatorLogoPath))
InputStream is = Files.newInputStream(Paths.get(generatorLogoPath))
```
## 观察者模式
@ -318,4 +318,4 @@ class PollingWatchService
- 装饰器模式:通过剖析 Java IO 类库源码学习装饰器模式https://time.geekbang.org/column/article/204845
- sun.nio 包是什么,是 java 代码么? - RednaxelaFX https://www.zhihu.com/question/29237781/answer/43653953
<!-- @include: @article-footer.snippet.md -->
<!-- @include: @article-footer.snippet.md -->