1 package rydeen.io;
2
3 import rydeen.ProcessTarget;
4 import rydeen.TargetSource;
5 import rydeen.TargetType;
6
7 import java.io.ByteArrayInputStream;
8 import java.io.IOException;
9 import java.io.InputStream;
10
11
12
13
14
15
16 public class ByteArrayProcessTarget extends AbstractProcessTarget{
17 private byte[] data;
18 private String name;
19
20
21
22
23
24
25
26
27
28
29
30
31 public ByteArrayProcessTarget(TargetSource source, String name, byte[] data){
32 this(source, name, data, TargetType.CLASS_FILE);
33 }
34
35
36
37
38
39
40
41
42 public ByteArrayProcessTarget(TargetSource source, String name, byte[] initData, TargetType type){
43 super(source, name, type);
44 this.name = name;
45 data = new byte[initData.length];
46 System.arraycopy(initData, 0, data, 0, data.length);
47 }
48
49
50
51
52
53 @Override
54 public String getName(){
55 return name;
56 }
57
58
59
60
61
62 @Override
63 public InputStream openStream() throws IOException{
64 return new ByteArrayInputStream(data);
65 }
66 }