mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-24 02:12:15 -05:00
commit
4b5189973b
@ -500,14 +500,20 @@ public class Utility {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
FileInputStream in = new FileInputStream(from);
|
FileInputStream in = new FileInputStream(from);
|
||||||
FileOutputStream out = new FileOutputStream(to);
|
try {
|
||||||
byte[] buffer = new byte[1024];
|
FileOutputStream out = new FileOutputStream(to);
|
||||||
int count = -1;
|
try {
|
||||||
while ((count = in.read(buffer)) > 0) {
|
byte[] buffer = new byte[1024];
|
||||||
out.write(buffer, 0, count);
|
int count = -1;
|
||||||
|
while ((count = in.read(buffer)) > 0) {
|
||||||
|
out.write(buffer, 0, count);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
try { in.close(); } catch (Throwable ignore) {}
|
||||||
}
|
}
|
||||||
out.close();
|
|
||||||
in.close();
|
|
||||||
from.delete();
|
from.delete();
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -46,8 +46,11 @@ public class BinaryTempFileBody implements Body {
|
|||||||
public void writeTo(OutputStream out) throws IOException, MessagingException {
|
public void writeTo(OutputStream out) throws IOException, MessagingException {
|
||||||
InputStream in = getInputStream();
|
InputStream in = getInputStream();
|
||||||
Base64OutputStream base64Out = new Base64OutputStream(out);
|
Base64OutputStream base64Out = new Base64OutputStream(out);
|
||||||
IOUtils.copy(in, base64Out);
|
try {
|
||||||
base64Out.close();
|
IOUtils.copy(in, base64Out);
|
||||||
|
} finally {
|
||||||
|
base64Out.close();
|
||||||
|
}
|
||||||
mFile.delete();
|
mFile.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1092,8 +1092,11 @@ public class MimeUtility {
|
|||||||
|
|
||||||
BinaryTempFileBody tempBody = new BinaryTempFileBody();
|
BinaryTempFileBody tempBody = new BinaryTempFileBody();
|
||||||
OutputStream out = tempBody.getOutputStream();
|
OutputStream out = tempBody.getOutputStream();
|
||||||
IOUtils.copy(in, out);
|
try {
|
||||||
out.close();
|
IOUtils.copy(in, out);
|
||||||
|
} finally {
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
return tempBody;
|
return tempBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2357,11 +2357,17 @@ public class LocalStore extends Store implements Serializable {
|
|||||||
* so we copy the data into a cached attachment file.
|
* so we copy the data into a cached attachment file.
|
||||||
*/
|
*/
|
||||||
InputStream in = attachment.getBody().getInputStream();
|
InputStream in = attachment.getBody().getInputStream();
|
||||||
tempAttachmentFile = File.createTempFile("att", null, attachmentDirectory);
|
try {
|
||||||
FileOutputStream out = new FileOutputStream(tempAttachmentFile);
|
tempAttachmentFile = File.createTempFile("att", null, attachmentDirectory);
|
||||||
size = IOUtils.copy(in, out);
|
FileOutputStream out = new FileOutputStream(tempAttachmentFile);
|
||||||
in.close();
|
try {
|
||||||
out.close();
|
size = IOUtils.copy(in, out);
|
||||||
|
} finally {
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
try { in.close(); } catch (Throwable ignore) {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3357,8 +3363,11 @@ public class LocalStore extends Store implements Serializable {
|
|||||||
public void writeTo(OutputStream out) throws IOException, MessagingException {
|
public void writeTo(OutputStream out) throws IOException, MessagingException {
|
||||||
InputStream in = getInputStream();
|
InputStream in = getInputStream();
|
||||||
Base64OutputStream base64Out = new Base64OutputStream(out);
|
Base64OutputStream base64Out = new Base64OutputStream(out);
|
||||||
IOUtils.copy(in, base64Out);
|
try {
|
||||||
base64Out.close();
|
IOUtils.copy(in, base64Out);
|
||||||
|
} finally {
|
||||||
|
base64Out.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Uri getContentUri() {
|
public Uri getContentUri() {
|
||||||
|
@ -180,11 +180,14 @@ public class AttachmentProvider extends ContentProvider {
|
|||||||
if (thumbnail != null) {
|
if (thumbnail != null) {
|
||||||
thumbnail = Bitmap.createScaledBitmap(thumbnail, width, height, true);
|
thumbnail = Bitmap.createScaledBitmap(thumbnail, width, height, true);
|
||||||
FileOutputStream out = new FileOutputStream(file);
|
FileOutputStream out = new FileOutputStream(file);
|
||||||
thumbnail.compress(Bitmap.CompressFormat.PNG, 100, out);
|
try {
|
||||||
out.close();
|
thumbnail.compress(Bitmap.CompressFormat.PNG, 100, out);
|
||||||
|
} finally {
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
in.close();
|
try { in.close(); } catch (Throwable ignore) {}
|
||||||
}
|
}
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user