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
|
@Override
|
||||||
public void preamble(InputStream is) throws IOException {
|
public void preamble(InputStream is) throws IOException {
|
||||||
expect(MimeMultipart.class);
|
expect(MimeMultipart.class);
|
||||||
StringBuilder sb = new StringBuilder();
|
ByteArrayOutputStream preamble = new ByteArrayOutputStream();
|
||||||
int b;
|
IOUtils.copy(is, preamble);
|
||||||
while ((b = is.read()) != -1) {
|
((MimeMultipart)stack.peek()).setPreamble(preamble.toByteArray());
|
||||||
sb.append((char)b);
|
|
||||||
}
|
|
||||||
((MimeMultipart)stack.peek()).setPreamble(sb.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -10,7 +10,7 @@ import java.util.Locale;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class MimeMultipart extends Multipart {
|
public class MimeMultipart extends Multipart {
|
||||||
private String mPreamble;
|
private byte[] mPreamble;
|
||||||
private byte[] mEpilogue;
|
private byte[] mEpilogue;
|
||||||
|
|
||||||
private String mContentType;
|
private String mContentType;
|
||||||
@ -46,11 +46,7 @@ public class MimeMultipart extends Multipart {
|
|||||||
return sb.toString().toUpperCase(Locale.US);
|
return sb.toString().toUpperCase(Locale.US);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPreamble() {
|
public void setPreamble(byte[] preamble) {
|
||||||
return mPreamble;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPreamble(String preamble) {
|
|
||||||
this.mPreamble = preamble;
|
this.mPreamble = preamble;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +68,7 @@ public class MimeMultipart extends Multipart {
|
|||||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out), 1024);
|
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out), 1024);
|
||||||
|
|
||||||
if (mPreamble != null) {
|
if (mPreamble != null) {
|
||||||
writer.write(mPreamble);
|
out.write(mPreamble);
|
||||||
writer.write("\r\n");
|
writer.write("\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user