mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
Store multi part preamble as byte array
This commit is contained in:
parent
3919c9d2d6
commit
e374538110
@ -567,12 +567,9 @@ public class MimeMessage extends Message {
|
||||
@Override
|
||||
public void preamble(InputStream is) throws IOException {
|
||||
expect(MimeMultipart.class);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int b;
|
||||
while ((b = is.read()) != -1) {
|
||||
sb.append((char)b);
|
||||
}
|
||||
((MimeMultipart)stack.peek()).setPreamble(sb.toString());
|
||||
ByteArrayOutputStream preamble = new ByteArrayOutputStream();
|
||||
IOUtils.copy(is, preamble);
|
||||
((MimeMultipart)stack.peek()).setPreamble(preamble.toByteArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -10,7 +10,7 @@ import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
public class MimeMultipart extends Multipart {
|
||||
private String mPreamble;
|
||||
private byte[] mPreamble;
|
||||
private byte[] mEpilogue;
|
||||
|
||||
private String mContentType;
|
||||
@ -46,11 +46,7 @@ public class MimeMultipart extends Multipart {
|
||||
return sb.toString().toUpperCase(Locale.US);
|
||||
}
|
||||
|
||||
public String getPreamble() {
|
||||
return mPreamble;
|
||||
}
|
||||
|
||||
public void setPreamble(String preamble) {
|
||||
public void setPreamble(byte[] preamble) {
|
||||
this.mPreamble = preamble;
|
||||
}
|
||||
|
||||
@ -72,7 +68,7 @@ public class MimeMultipart extends Multipart {
|
||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out), 1024);
|
||||
|
||||
if (mPreamble != null) {
|
||||
writer.write(mPreamble);
|
||||
out.write(mPreamble);
|
||||
writer.write("\r\n");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user