質問編集履歴
1
追記でソース更新
test
CHANGED
File without changes
|
test
CHANGED
@@ -41,3 +41,65 @@
|
|
41
41
|
fos.close();
|
42
42
|
|
43
43
|
}
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
~追記~
|
48
|
+
|
49
|
+
バイト列を取得し保存する方法を模索
|
50
|
+
|
51
|
+
【ソース】
|
52
|
+
|
53
|
+
public void savetmpFile(ExchangeService service, Item item) throws Exception {
|
54
|
+
|
55
|
+
Stream<Attachment> fis = item.getAttachments().getItems().stream();
|
56
|
+
|
57
|
+
byte[] bytes = fis.toString().getBytes();
|
58
|
+
|
59
|
+
FileOutputStream fos = new FileOutputStream(saveFilePath);
|
60
|
+
|
61
|
+
for (byte b : bytes) {
|
62
|
+
|
63
|
+
fos.write(b);
|
64
|
+
|
65
|
+
}
|
66
|
+
|
67
|
+
fos.flush();
|
68
|
+
|
69
|
+
fos.close();
|
70
|
+
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
【実行結果(zipファイル)】
|
76
|
+
|
77
|
+
zipファイルの中身が空です。(解凍不能)
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
【実行結果(テキストファイル)】
|
82
|
+
|
83
|
+
java.util.stream.ReferencePipeline$Head@32193bea
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
また、上記ソースのbytesを以下に変更して実行
|
92
|
+
|
93
|
+
byte[] bytes = item.getAttachments().getItems().toString().getBytes();
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
【実行結果(zipファイル)】
|
98
|
+
|
99
|
+
zipファイルの中身が空です。(解凍不能)
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
【実行結果(テキストファイル)】
|
104
|
+
|
105
|
+
[microsoft.exchange.webservices.data.property.complex.FileAttachment@1bb5a082]
|