@Test(expected = IOException.class) public void shouldThrowIOExceptionWhenInvalidCharset() throws IOException { String invalidCharset = "@MSADG"; Part part = new StringPart(name, content, invalidCharset, ContentType.CONTENT_TYPE_TEXT_PLAIN); part.getContent(); }
@Override public InputStream getContent() throws IOException { byte[] bytes = getBytesFromContent(); if (bytes == null) { return null; } InputStream is = new ByteArrayInputStream(bytes); return is; }
StringPart extends AbstractPart { @Override public InputStream getContent() throws IOException { byte[] bytes = getBytesFromContent(); if (bytes == null) { return null; } InputStream is = new ByteArrayInputStream(bytes); return is; } }
StringPart extends AbstractPart { @Override public InputStream getContent() throws IOException { byte[] bytes = getBytesFromContent(); if (bytes == null) { return null; } InputStream is = new ByteArrayInputStream(bytes); return is; } StringPart(String name, String content);  StringPart(String name, String content, String charset);  StringPart(String name, String content, String charset, ContentType contentType); }
StringPart extends AbstractPart { @Override public InputStream getContent() throws IOException { byte[] bytes = getBytesFromContent(); if (bytes == null) { return null; } InputStream is = new ByteArrayInputStream(bytes); return is; } StringPart(String name, String content);  StringPart(String name, String content, String charset);  StringPart(String name, String content, String charset, ContentType contentType); @Override ContentType getContentType(); @Override InputStream getContent(); }
StringPart extends AbstractPart { @Override public InputStream getContent() throws IOException { byte[] bytes = getBytesFromContent(); if (bytes == null) { return null; } InputStream is = new ByteArrayInputStream(bytes); return is; } StringPart(String name, String content);  StringPart(String name, String content, String charset);  StringPart(String name, String content, String charset, ContentType contentType); @Override ContentType getContentType(); @Override InputStream getContent();  }