forked from echoTheLiar/JavaCodeAcc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdapterClient.java
More file actions
26 lines (22 loc) · 737 Bytes
/
AdapterClient.java
File metadata and controls
26 lines (22 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package designpattern.adapter;
import com.sun.xml.internal.messaging.saaj.util.ByteInputStream;
import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
/**
* 适配器模式用于将不兼容的接口适配到客户端所需要的接口。
*
* @author liu yuning
*/
public class AdapterClient {
public static void main(String[] args) {
//字节流转字符流
new ByteInputStream();
new InputStreamReader(new ByteInputStream());
new OutputStreamWriter(new ByteOutputStream());
Target target;
Adaptee adaptee = new Adaptee();
target = new Adapter(adaptee);
target.request();
}
}