You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by re...@locus.apache.org on 2000/07/30 07:01:17 UTC
cvs commit: jakarta-slide/src/share/org/apache/slide/content NodeRevisionContent.java
remm 00/07/29 22:01:17
Modified: src/share/org/apache/slide/content NodeRevisionContent.java
Log:
- Added support for InputStreams to access content.
The streamContent (which uses the InputStream) and the
readContent (which uses the Reader) are mutually exclusive,
since it's possible for the Reader to be constructed as an
InputStreamReader.
Revision Changes Path
1.2 +13 -11 jakarta-slide/src/share/org/apache/slide/content/NodeRevisionContent.java
Index: NodeRevisionContent.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/content/NodeRevisionContent.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NodeRevisionContent.java 2000/05/09 02:47:24 1.1
+++ NodeRevisionContent.java 2000/07/30 05:01:16 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/content/NodeRevisionContent.java,v 1.1 2000/05/09 02:47:24 remm Exp $
- * $Revision: 1.1 $
- * $Date: 2000/05/09 02:47:24 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/content/NodeRevisionContent.java,v 1.2 2000/07/30 05:01:16 remm Exp $
+ * $Revision: 1.2 $
+ * $Date: 2000/07/30 05:01:16 $
*
* ====================================================================
*
@@ -71,7 +71,7 @@
* Encapsultes the contents of a revision.
*
* @author <a href="mailto:remm@exoffice.com">Remy Maucherat</a>
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public final class NodeRevisionContent implements Serializable {
@@ -99,8 +99,6 @@
/**
* Input stream.
- *
- * @deprecated Unsupported for now
*/
private transient InputStream inputStream = null;
@@ -119,8 +117,10 @@
char[] result = null;
if (content != null) {
result = content;
+ inputStream = null;
} else {
if (reader != null) {
+ inputStream = null;
try {
// Limitation : this function can only handle 4Go of data,
// which should not be a problem.
@@ -153,9 +153,11 @@
Reader result = null;
if (content != null) {
result = new CharArrayReader(content);
+ inputStream = null;
}
if (reader != null) {
result = reader;
+ inputStream = null;
}
return result;
}
@@ -165,12 +167,14 @@
* Content accessor.
*
* @return InputStream
- * @deprecated Unsupported for now
*/
public InputStream streamContent()
throws IOException {
- InputStream result = null;
- return result;
+ if (inputStream != null) {
+ content = null;
+ reader = null;
+ }
+ return inputStream;
}
@@ -203,8 +207,6 @@
*/
public void setContent(InputStream inputStream) {
this.inputStream = inputStream;
- this.reader = null;
- this.content = null;
}