}
private static PartContentBuilder build(int[] path, final Message<?> message)
throws IOException, MimeException {
final InputStream stream = message.getFullContent();
PartContentBuilder result = new PartContentBuilder();
result.parse(stream);
try {
for (int i = 0; i < path.length; i++) {
final int next = path[i];
result.to(next);
}
} catch (PartContentBuilder.PartNotFoundException e) {
// Missing parts should return zero sized content
// See http://markmail.org/message/2jconrj7scvdi5dj
result.markEmpty();
}
return result;
}