Author: mwiederkehr
Date: Mon Feb 2 13:07:45 2009
New Revision: 739986
URL: http://svn.apache.org/viewvc?rev=739986&view=rev
Log:
MIME4J-111: converted TextBody and BinaryBody into abstract subclasses of
SingleBody.
Modified:
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/BinaryBody.java
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/BodyFactory.java
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/StorageBinaryBody.java
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/StorageTextBody.java
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/StringTextBody.java
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/TextBody.java
Modified:
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/BinaryBody.java
URL:
http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/BinaryBody.java?rev=739986&r1=739985&r2=739986&view=diff
==============================================================================
---
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/BinaryBody.java
(original)
+++
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/BinaryBody.java
Mon Feb 2 13:07:45 2009
@@ -22,21 +22,16 @@
import java.io.IOException;
import java.io.InputStream;
-
/**
- * Interface implemented by bodies containing binary data.
- *
- *
- * @version $Id: BinaryBody.java,v 1.3 2004/10/02 12:41:11 ntherning Exp $
+ * A body containing binary data.
*/
-public interface BinaryBody extends Body {
-
+public abstract class BinaryBody extends SingleBody {
/**
- * Gets a <code>InputStream</code> which reads the bytes of the
- * body.
+ * Gets a <code>InputStream</code> which reads the bytes of the body.
*
* @return the stream, transfer decoded
- * @throws IOException on I/O errors.
+ * @throws IOException
+ * on I/O errors.
*/
- InputStream getInputStream() throws IOException;
+ public abstract InputStream getInputStream() throws IOException;
}
Modified:
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/BodyFactory.java
URL:
http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/BodyFactory.java?rev=739986&r1=739985&r2=739986&view=diff
==============================================================================
---
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/BodyFactory.java
(original)
+++
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/BodyFactory.java
Mon Feb 2 13:07:45 2009
@@ -81,8 +81,7 @@
*
* @param is
* input stream to create a message body from.
- * @return a {...@link SingleBody} that implements the {...@link
BinaryBody}
- * interface.
+ * @return a binary body.
* @throws IOException
* if an I/O error occurs.
*/
@@ -106,8 +105,7 @@
*
* @param storage
* storage to create a message body from.
- * @return a {...@link SingleBody} that implements the {...@link
BinaryBody}
- * interface.
+ * @return a binary body.
* @throws IOException
* if an I/O error occurs.
*/
@@ -128,8 +126,7 @@
*
* @param is
* input stream to create a message body from.
- * @return a {...@link SingleBody} that implements the {...@link TextBody}
- * interface.
+ * @return a text body.
* @throws IOException
* if an I/O error occurs.
*/
@@ -156,8 +153,7 @@
* input stream to create a message body from.
* @param mimeCharset
* name of a MIME charset.
- * @return a {...@link SingleBody} that implements the {...@link TextBody}
- * interface.
+ * @return a text body.
* @throws IOException
* if an I/O error occurs.
*/
@@ -189,8 +185,7 @@
*
* @param storage
* storage to create a message body from.
- * @return a {...@link SingleBody} that implements the {...@link TextBody}
- * interface.
+ * @return a text body.
* @throws IOException
* if an I/O error occurs.
*/
@@ -223,8 +218,7 @@
* storage to create a message body from.
* @param mimeCharset
* name of a MIME charset.
- * @return a {...@link SingleBody} that implements the {...@link TextBody}
- * interface.
+ * @return a text body.
* @throws IOException
* if an I/O error occurs.
*/
@@ -249,8 +243,7 @@
*
* @param text
* text to create a message body from.
- * @return a {...@link SingleBody} that implements the {...@link TextBody}
- * interface.
+ * @return a text body.
*/
public TextBody textBody(String text) {
if (text == null)
@@ -273,8 +266,7 @@
* text to create a message body from.
* @param mimeCharset
* name of a MIME charset.
- * @return a {...@link SingleBody} that implements the {...@link TextBody}
- * interface.
+ * @return a text body.
*/
public TextBody textBody(String text, String mimeCharset) {
if (text == null)
Modified:
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/StorageBinaryBody.java
URL:
http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/StorageBinaryBody.java?rev=739986&r1=739985&r2=739986&view=diff
==============================================================================
---
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/StorageBinaryBody.java
(original)
+++
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/StorageBinaryBody.java
Mon Feb 2 13:07:45 2009
@@ -30,17 +30,15 @@
* Binary body backed by a
* {...@link org.apache.james.mime4j.storage.Storage}
*/
-class StorageBinaryBody extends SingleBody implements BinaryBody {
+class StorageBinaryBody extends BinaryBody {
- private MultiReferenceStorage storage = null;
+ private MultiReferenceStorage storage;
public StorageBinaryBody(final MultiReferenceStorage storage) {
this.storage = storage;
}
- /**
- * @see org.apache.james.mime4j.message.BinaryBody#getInputStream()
- */
+ @Override
public InputStream getInputStream() throws IOException {
return storage.getInputStream();
}
Modified:
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/StorageTextBody.java
URL:
http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/StorageTextBody.java?rev=739986&r1=739985&r2=739986&view=diff
==============================================================================
---
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/StorageTextBody.java
(original)
+++
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/StorageTextBody.java
Mon Feb 2 13:07:45 2009
@@ -33,7 +33,7 @@
/**
* Text body backed by a {...@link org.apache.james.mime4j.storage.Storage}.
*/
-class StorageTextBody extends SingleBody implements TextBody {
+class StorageTextBody extends TextBody {
private MultiReferenceStorage storage;
private Charset charset;
@@ -43,16 +43,12 @@
this.charset = charset;
}
- /**
- * @see org.apache.james.mime4j.message.TextBody#getMimeCharset()
- */
+ @Override
public String getMimeCharset() {
return CharsetUtil.toMimeCharset(charset.name());
}
- /**
- * @see org.apache.james.mime4j.message.TextBody#getReader()
- */
+ @Override
public Reader getReader() throws IOException {
return new InputStreamReader(storage.getInputStream(), charset);
}
Modified:
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/StringTextBody.java
URL:
http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/StringTextBody.java?rev=739986&r1=739985&r2=739986&view=diff
==============================================================================
---
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/StringTextBody.java
(original)
+++
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/StringTextBody.java
Mon Feb 2 13:07:45 2009
@@ -32,7 +32,7 @@
/**
* Text body backed by a <code>String</code>.
*/
-class StringTextBody extends SingleBody implements TextBody {
+class StringTextBody extends TextBody {
private final String text;
private final Charset charset;
@@ -42,16 +42,12 @@
this.charset = charset;
}
- /**
- * @see org.apache.james.mime4j.message.TextBody#getMimeCharset()
- */
+ @Override
public String getMimeCharset() {
return CharsetUtil.toMimeCharset(charset.name());
}
- /**
- * @see org.apache.james.mime4j.message.TextBody#getReader()
- */
+ @Override
public Reader getReader() throws IOException {
return new StringReader(text);
}
Modified:
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/TextBody.java
URL:
http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/TextBody.java?rev=739986&r1=739985&r2=739986&view=diff
==============================================================================
---
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/TextBody.java
(original)
+++
james/mime4j/trunk/src/main/java/org/apache/james/mime4j/message/TextBody.java
Mon Feb 2 13:07:45 2009
@@ -22,27 +22,24 @@
import java.io.IOException;
import java.io.Reader;
-
/**
* Encapsulates the contents of a <code>text/*</code> entity body.
- *
- *
- * @version $Id: TextBody.java,v 1.3 2004/10/02 12:41:11 ntherning Exp $
*/
-public interface TextBody extends Body {
+public abstract class TextBody extends SingleBody {
/**
* Returns the MIME charset of this text body.
*
* @return the MIME charset.
*/
- String getMimeCharset();
+ public abstract String getMimeCharset();
/**
* Gets a <code>Reader</code> which may be used to read out the contents
* of this body.
*
* @return the <code>Reader</code>.
- * @throws IOException on I/O errors.
+ * @throws IOException
+ * on I/O errors.
*/
- Reader getReader() throws IOException;
+ public abstract Reader getReader() throws IOException;
}