@Test public void testNoPreambule() { String boundary = "boundary"; final byte[] chunk1 = ("--" + boundary + "Content-Id: part1\n" + "\n" + "1\n" + "--" + boundary + "--").getBytes(); List<MimePart> parts = parse("boundary", chunk1).parts; assertThat(parts.size(), is(equalTo(1))); MimePart part1 = parts.get(0); assertThat(part1.headers.get("-" + boundary + "Content-Id"), hasItems("part1")); assertThat(part1.content, is(notNullValue())); assertThat(new String(part1.content), is(equalTo("1"))); }
private static byte[] getBytes(String str) { char[] chars = str.toCharArray(); int size = chars.length; byte[] bytes = new byte[size]; for (int i = 0; i < size;) { bytes[i] = (byte) chars[i++]; } return bytes; }
MimeParser { private static byte[] getBytes(String str) { char[] chars = str.toCharArray(); int size = chars.length; byte[] bytes = new byte[size]; for (int i = 0; i < size;) { bytes[i] = (byte) chars[i++]; } return bytes; } }
MimeParser { private static byte[] getBytes(String str) { char[] chars = str.toCharArray(); int size = chars.length; byte[] bytes = new byte[size]; for (int i = 0; i < size;) { bytes[i] = (byte) chars[i++]; } return bytes; } MimeParser(String boundary); }
MimeParser { private static byte[] getBytes(String str) { char[] chars = str.toCharArray(); int size = chars.length; byte[] bytes = new byte[size]; for (int i = 0; i < size;) { bytes[i] = (byte) chars[i++]; } return bytes; } MimeParser(String boundary);  }
MimeParser { private static byte[] getBytes(String str) { char[] chars = str.toCharArray(); int size = chars.length; byte[] bytes = new byte[size]; for (int i = 0; i < size;) { bytes[i] = (byte) chars[i++]; } return bytes; } MimeParser(String boundary);   }