質問編集履歴
1
追記でソース更新
title
CHANGED
File without changes
|
body
CHANGED
@@ -19,4 +19,35 @@
|
|
19
19
|
FileOutputStream fos = new FileOutputStream("保存先のパス");
|
20
20
|
fos.write(mc.getContent(), 0, mc.getContent().length);
|
21
21
|
fos.close();
|
22
|
-
}
|
22
|
+
}
|
23
|
+
|
24
|
+
~追記~
|
25
|
+
バイト列を取得し保存する方法を模索
|
26
|
+
【ソース】
|
27
|
+
public void savetmpFile(ExchangeService service, Item item) throws Exception {
|
28
|
+
Stream<Attachment> fis = item.getAttachments().getItems().stream();
|
29
|
+
byte[] bytes = fis.toString().getBytes();
|
30
|
+
FileOutputStream fos = new FileOutputStream(saveFilePath);
|
31
|
+
for (byte b : bytes) {
|
32
|
+
fos.write(b);
|
33
|
+
}
|
34
|
+
fos.flush();
|
35
|
+
fos.close();
|
36
|
+
}
|
37
|
+
|
38
|
+
【実行結果(zipファイル)】
|
39
|
+
zipファイルの中身が空です。(解凍不能)
|
40
|
+
|
41
|
+
【実行結果(テキストファイル)】
|
42
|
+
java.util.stream.ReferencePipeline$Head@32193bea
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
また、上記ソースのbytesを以下に変更して実行
|
47
|
+
byte[] bytes = item.getAttachments().getItems().toString().getBytes();
|
48
|
+
|
49
|
+
【実行結果(zipファイル)】
|
50
|
+
zipファイルの中身が空です。(解凍不能)
|
51
|
+
|
52
|
+
【実行結果(テキストファイル)】
|
53
|
+
[microsoft.exchange.webservices.data.property.complex.FileAttachment@1bb5a082]
|