(Object o, boolean base64)
| 235 | } |
| 236 | |
| 237 | private ByteArrayInputStream getStream(Object o, boolean base64) { |
| 238 | if (o instanceof byte[]) { |
| 239 | return new ByteArrayInputStream((byte[]) o); |
| 240 | } else { |
| 241 | String content = o.toString(); |
| 242 | if (base64 && content.contains("base64,")) content = content.split("base64,")[1]; |
| 243 | return new ByteArrayInputStream(base64 ? Util.decode(content) : content.getBytes()); |
| 244 | } |
| 245 | } |
| 246 | } |