mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-06 17:13:23 +02:00
PGP: retry with trim
This commit is contained in:
@@ -88,6 +88,7 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.FilterInputStream;
|
||||
import java.io.FilterOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -6130,6 +6131,47 @@ public class MessageHelper {
|
||||
}
|
||||
}
|
||||
|
||||
static class StripStream extends FilterInputStream {
|
||||
protected StripStream(InputStream in) {
|
||||
super(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
int b = super.read();
|
||||
if (b == ' ') {
|
||||
super.mark(1000);
|
||||
while (true) {
|
||||
b = super.read();
|
||||
if (b != ' ') {
|
||||
if (b == '\r' || b == '\n')
|
||||
return b;
|
||||
else {
|
||||
super.reset();
|
||||
return ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] b) throws IOException {
|
||||
for (int i = 0; i < b.length; i++) {
|
||||
b[i] = (byte) read();
|
||||
if (b[i] < 0)
|
||||
return i;
|
||||
}
|
||||
return b.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] b, int off, int len) throws IOException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
static class CanonicalizingStream extends FilterOutputStream {
|
||||
private OutputStream os;
|
||||
private int content;
|
||||
|
||||
Reference in New Issue
Block a user