InputStream () { if (myBytes != null) { return new ByteArrayInputStream(myBytes); } if (myTemporaryFile != null) { try { return Files.newInputStream(myTemporaryFile); } catch (IOException e) { LOG.error("Failed to read attachment content from temp. file " + myTemporaryFile, e); } } if (myDisplayText != null) { return new ByteArrayInputStream(myDisplayText.getBytes(StandardCharsets.UTF_8)); } return new ByteArrayInputStream(ArrayUtil.EMPTY_BYTE_ARRAY); }