From 7aa2fb2862255c1df1f348ee51185a6af6dbad63 Mon Sep 17 00:00:00 2001 From: adam Date: Sat, 17 Mar 2007 10:33:35 +0000 Subject: [PATCH] minor cleanup in MIME.java darcs-hash:20070317103335-5007d-62f4bbcc5ea1c05b8f9b5c97b470c5ac3147c124.gz --- src/org/ibex/mail/MIME.java | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/org/ibex/mail/MIME.java b/src/org/ibex/mail/MIME.java index 36d125b..e17dd8c 100644 --- a/src/org/ibex/mail/MIME.java +++ b/src/org/ibex/mail/MIME.java @@ -33,18 +33,6 @@ public class MIME { public long getLength() { return all.getLength(); } public Fountain getBody() { return body; } - private class BodyFountain implements Fountain { - public int getNumLines() { return Stream.countLines(getStream()); } - public long getLength() { return Part.this.getLength() - headers.getLength() - 2 /*FIXME: correct?*/; } - public Stream getStream() { - return /* - "quoted-printable".equals(encoding) ? Encode.QuotedPrintable.decode(body.toString(),false) : - "base64".equals(encoding) ? Encode.fromBase64(body.toString()) : - */ - Headers.Original.skip(all.getStream()); - } - } - public Part(Fountain all) { this.headers = new Headers(all); String ctype = headers.get("content-type"); @@ -58,7 +46,17 @@ public class MIME { } this.contentType = new ContentType(ctype, headers.get("content-description"), headers.get("content-id"), encoding); this.all = all; - this.body = new BodyFountain(); + this.body = new Fountain() { + public int getNumLines() { return Stream.countLines(getStream()); } + public long getLength() { return Part.this.getLength() - headers.getLength() - 2 /*CRLF*/; } + public Stream getStream() { return transformBodyStream(Headers.skip(Part.this.all.getStream())); } + }; + } + + private Stream transformBodyStream(Stream body) { + //"quoted-printable".equals(encoding) ? Encode.QuotedPrintable.decode(body.toString(),false) : + //"base64".equals(encoding) ? Encode.fromBase64(body.toString()) : + return body; } /* @@ -78,6 +76,7 @@ public class MIME { } */ } + /* public static class Boundary implements Stream.Transformer { private final String boundary; -- 1.7.10.4