You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by bl...@apache.org on 2001/03/12 06:55:28 UTC
cvs commit: xml-cocoon/src/org/apache/cocoon/xml CompiledXMLInputStream.java CompiledXMLOutputStream.java FastInputStream.java XMLInterpreter.java
bloritsch 01/03/11 21:55:28
Modified: src/org/apache/cocoon Tag: xml-cocoon2 Cocoon.java Main.java
Processor.java
src/org/apache/cocoon/acting Tag: xml-cocoon2
AbstractDatabaseAction.java
src/org/apache/cocoon/components/classloader Tag:
xml-cocoon2 RepositoryClassLoader.java
src/org/apache/cocoon/components/language/markup/xsp Tag:
xml-cocoon2 XSPUtil.java
src/org/apache/cocoon/environment Tag: xml-cocoon2
AbstractEnvironment.java
src/org/apache/cocoon/environment/http Tag: xml-cocoon2
RequestWrapper22.java RequestWrapper23.java
src/org/apache/cocoon/reading Tag: xml-cocoon2
AbstractReader.java DatabaseReader.java
ResourceReader.java
src/org/apache/cocoon/serialization Tag: xml-cocoon2
AbstractSerializer.java
src/org/apache/cocoon/sitemap Tag: xml-cocoon2
AbstractSitemap.java Handler.java
LinkTranslator.java Manager.java
src/org/apache/cocoon/transformation Tag: xml-cocoon2
I18nTransformer.java XIncludeTransformer.java
src/org/apache/cocoon/util Tag: xml-cocoon2 IOUtils.java
src/org/apache/cocoon/util/url/context Tag: xml-cocoon2
Handler.java
src/org/apache/cocoon/util/url/resource Tag: xml-cocoon2
Handler.java
src/org/apache/cocoon/xml Tag: xml-cocoon2
CompiledXMLInputStream.java
CompiledXMLOutputStream.java FastInputStream.java
XMLInterpreter.java
Log:
BufferedStream Optimizations
Revision Changes Path
No revision
No revision
1.4.2.63 +1 -3 xml-cocoon/src/org/apache/cocoon/Cocoon.java
Index: Cocoon.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Cocoon.java,v
retrieving revision 1.4.2.62
retrieving revision 1.4.2.63
diff -u -r1.4.2.62 -r1.4.2.63
--- Cocoon.java 2001/03/12 05:17:59 1.4.2.62
+++ Cocoon.java 2001/03/12 05:55:17 1.4.2.63
@@ -9,10 +9,8 @@
package org.apache.cocoon;
import java.io.File;
-import java.io.FileReader;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.io.OutputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.Enumeration;
@@ -49,7 +47,7 @@
*
* @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a> (Apache Software Foundation, Exoffice Technologies)
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.4.2.62 $ $Date: 2001/03/12 05:17:59 $
+ * @version CVS $Revision: 1.4.2.63 $ $Date: 2001/03/12 05:55:17 $
*/
public class Cocoon extends AbstractLoggable implements Component, Initializable, Modifiable, Processor, Contextualizable {
/** The application context */
1.1.4.26 +4 -3 xml-cocoon/src/org/apache/cocoon/Attic/Main.java
Index: Main.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Main.java,v
retrieving revision 1.1.4.25
retrieving revision 1.1.4.26
diff -u -r1.1.4.25 -r1.1.4.26
--- Main.java 2001/02/24 20:04:18 1.1.4.25
+++ Main.java 2001/03/12 05:55:18 1.1.4.26
@@ -12,6 +12,7 @@
import java.io.IOException;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
+import java.io.BufferedOutputStream;
import java.io.PrintStream;
import java.io.OutputStream;
@@ -49,7 +50,7 @@
* Command line entry point.
*
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.4.25 $ $Date: 2001/02/24 20:04:18 $
+ * @version CVS $Revision: 1.1.4.26 $ $Date: 2001/03/12 05:55:18 $
*/
public class Main {
@@ -367,7 +368,7 @@
String filename = mangle(uri);
File file = IOUtils.createFile(destDir, filename);
- FileOutputStream output = new FileOutputStream(file);
+ OutputStream output = new BufferedOutputStream(new FileOutputStream(file));
String type = getPage(uri, translatedLinks, output);
output.close();
@@ -393,7 +394,7 @@
}
private void resourceUnavailable(File file) throws IOException {
- PrintStream out = new PrintStream(new FileOutputStream(file));
+ PrintStream out = new PrintStream(new BufferedOutputStream(new FileOutputStream(file)));
out.println(
"<html><head><title>Page Not Available</title></head>" +
"<body><h1 align=\"center\">Page Not Available</h1>" +
1.1.2.8 +1 -6 xml-cocoon/src/org/apache/cocoon/Attic/Processor.java
Index: Processor.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Processor.java,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -r1.1.2.7 -r1.1.2.8
--- Processor.java 2000/12/11 16:06:27 1.1.2.7
+++ Processor.java 2001/03/12 05:55:18 1.1.2.8
@@ -7,18 +7,13 @@
*****************************************************************************/
package org.apache.cocoon;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.xml.sax.SAXException;
-
import org.apache.cocoon.environment.Environment;
/**
*
* @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.1.2.7 $ $Date: 2000/12/11 16:06:27 $
+ * @version CVS $Revision: 1.1.2.8 $ $Date: 2001/03/12 05:55:18 $
*/
public interface Processor {
/**
No revision
No revision
1.1.2.19 +6 -5 xml-cocoon/src/org/apache/cocoon/acting/Attic/AbstractDatabaseAction.java
Index: AbstractDatabaseAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/AbstractDatabaseAction.java,v
retrieving revision 1.1.2.18
retrieving revision 1.1.2.19
diff -u -r1.1.2.18 -r1.1.2.19
--- AbstractDatabaseAction.java 2001/03/12 04:38:31 1.1.2.18
+++ AbstractDatabaseAction.java 2001/03/12 05:55:19 1.1.2.19
@@ -21,6 +21,7 @@
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.StringBufferInputStream;
+import java.io.BufferedInputStream;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
@@ -171,7 +172,7 @@
* </table>
*
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.18 $ $Date: 2001/03/12 04:38:31 $
+ * @version CVS $Revision: 1.1.2.19 $ $Date: 2001/03/12 05:55:19 $
*/
public abstract class AbstractDatabaseAction extends AbstractComplimentaryConfigurableAction implements Configurable {
protected Map files = new HashMap();
@@ -265,11 +266,11 @@
if (attr instanceof File) {
File asciiFile = (File) attr;
- asciiStream = new FileInputStream(asciiFile);
+ asciiStream = new BufferedInputStream(new FileInputStream(asciiFile));
length = (int) asciiFile.length();
} else {
String asciiText = (String) attr;
- asciiStream = new StringBufferInputStream(asciiText);
+ asciiStream = new BufferedInputStream(new StringBufferInputStream(asciiText));
length = asciiText.length();
}
@@ -280,7 +281,7 @@
break;
case Types.BLOB:
File binaryFile = (File) request.get(attribute);
- FileInputStream binaryStream = new FileInputStream(binaryFile);
+ InputStream binaryStream = new BufferedInputStream(new FileInputStream(binaryFile));
statement.setBinaryStream(position, binaryStream, (int) binaryFile.length());
break;
case Types.TINYINT:
@@ -320,7 +321,7 @@
// Upload an image (just like binary), but cache attributes
Parameters param = new Parameters();
File imageFile = (File) request.get(attribute);
- FileInputStream imageStream = new FileInputStream(imageFile);
+ InputStream imageStream = new BufferedInputStream(new FileInputStream(imageFile));
statement.setBinaryStream(position, imageStream, (int) imageFile.length());
param.setParameter("image-size", Long.toString(imageFile.length()));
No revision
No revision
1.1.2.22 +1 -2 xml-cocoon/src/org/apache/cocoon/components/classloader/Attic/RepositoryClassLoader.java
Index: RepositoryClassLoader.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/classloader/Attic/RepositoryClassLoader.java,v
retrieving revision 1.1.2.21
retrieving revision 1.1.2.22
diff -u -r1.1.2.21 -r1.1.2.22
--- RepositoryClassLoader.java 2001/02/14 11:39:34 1.1.2.21
+++ RepositoryClassLoader.java 2001/03/12 05:55:19 1.1.2.22
@@ -11,7 +11,6 @@
import java.util.Iterator;
import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
@@ -34,7 +33,7 @@
*
* @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
* @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.21 $ $Date: 2001/02/14 11:39:34 $
+ * @version CVS $Revision: 1.1.2.22 $ $Date: 2001/03/12 05:55:19 $
*/
public class RepositoryClassLoader extends URLClassLoader implements Loggable {
No revision
No revision
1.1.2.8 +7 -5 xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPUtil.java
Index: XSPUtil.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/xsp/Attic/XSPUtil.java,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -r1.1.2.7 -r1.1.2.8
--- XSPUtil.java 2001/02/12 13:30:43 1.1.2.7
+++ XSPUtil.java 2001/03/12 05:55:19 1.1.2.8
@@ -18,6 +18,8 @@
import java.io.FileReader;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
import java.net.URL;
@@ -44,7 +46,7 @@
* The XSP <code>Utility</code> object helper
* @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
* @author <a href="mailto:bloritsch@apache.org>Berin Loritsch</a>
- * @version $Revision: 1.1.2.7 $ $Date: 2001/02/12 13:30:43 $
+ * @version $Revision: 1.1.2.8 $ $Date: 2001/03/12 05:55:19 $
*/
public class XSPUtil {
public static String pathComponent(String filename) {
@@ -217,22 +219,22 @@
public static String getFileContents(String filename) throws IOException {
return getContents(
- new FileReader(filename));
+ new BufferedReader(new FileReader(filename)));
}
public static String getFileContents(String filename, String encoding) throws IOException {
return getContents(
- new FileInputStream(filename), encoding);
+ new BufferedInputStream(new FileInputStream(filename)), encoding);
}
public static String getContents(InputStream in, String encoding) throws IOException {
return getContents(
- new InputStreamReader(in, encoding));
+ new BufferedReader(new InputStreamReader(in, encoding)));
}
public static String getContents(InputStream in) throws IOException {
return getContents(
- new InputStreamReader(in));
+ new BufferedReader(new InputStreamReader(in)));
}
public static String getContents(Reader reader) throws IOException {
No revision
No revision
1.1.2.12 +0 -1 xml-cocoon/src/org/apache/cocoon/environment/Attic/AbstractEnvironment.java
Index: AbstractEnvironment.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/environment/Attic/AbstractEnvironment.java,v
retrieving revision 1.1.2.11
retrieving revision 1.1.2.12
diff -u -r1.1.2.11 -r1.1.2.12
--- AbstractEnvironment.java 2001/02/23 14:01:26 1.1.2.11
+++ AbstractEnvironment.java 2001/03/12 05:55:20 1.1.2.12
@@ -10,7 +10,6 @@
import java.io.File;
import java.io.IOException;
-import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;
No revision
No revision
1.1.2.2 +0 -1 xml-cocoon/src/org/apache/cocoon/environment/http/Attic/RequestWrapper22.java
Index: RequestWrapper22.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/environment/http/Attic/RequestWrapper22.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- RequestWrapper22.java 2001/02/27 15:57:06 1.1.2.1
+++ RequestWrapper22.java 2001/03/12 05:55:21 1.1.2.2
@@ -15,7 +15,6 @@
import java.util.Locale;
import java.util.Vector;
-import javax.servlet.ServletInputStream;
import javax.servlet.RequestDispatcher;
import javax.servlet.http.Cookie;
1.1.2.2 +1 -2 xml-cocoon/src/org/apache/cocoon/environment/http/Attic/RequestWrapper23.java
Index: RequestWrapper23.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/environment/http/Attic/RequestWrapper23.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- RequestWrapper23.java 2001/02/27 15:57:07 1.1.2.1
+++ RequestWrapper23.java 2001/03/12 05:55:22 1.1.2.2
@@ -15,7 +15,6 @@
import java.util.Locale;
import java.util.Vector;
-import javax.servlet.ServletInputStream;
import javax.servlet.RequestDispatcher;
import javax.servlet.http.Cookie;
@@ -52,4 +51,4 @@
// FIXME:
return null;
}
-}
\ No newline at end of file
+}
No revision
No revision
1.1.2.11 +3 -2 xml-cocoon/src/org/apache/cocoon/reading/Attic/AbstractReader.java
Index: AbstractReader.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/reading/Attic/AbstractReader.java,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -u -r1.1.2.10 -r1.1.2.11
--- AbstractReader.java 2001/02/22 17:10:41 1.1.2.10
+++ AbstractReader.java 2001/03/12 05:55:23 1.1.2.11
@@ -8,6 +8,7 @@
package org.apache.cocoon.reading;
import java.io.OutputStream;
+import java.io.BufferedOutputStream;
import java.util.Map;
import org.xml.sax.EntityResolver;
@@ -19,7 +20,7 @@
/**
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.10 $ $Date: 2001/02/22 17:10:41 $
+ * @version CVS $Revision: 1.1.2.11 $ $Date: 2001/03/12 05:55:23 $
*/
public abstract class AbstractReader extends AbstractLoggable implements Poolable, Reader {
/** The current <code>EntityResolver</code>. */
@@ -48,7 +49,7 @@
* Set the <code>OutputStream</code>
*/
public void setOutputStream(OutputStream out) {
- this.out=out;
+ this.out = new BufferedOutputStream(out);
}
/**
1.1.2.6 +1 -1 xml-cocoon/src/org/apache/cocoon/reading/Attic/DatabaseReader.java
Index: DatabaseReader.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/reading/Attic/DatabaseReader.java,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- DatabaseReader.java 2001/03/12 04:38:58 1.1.2.5
+++ DatabaseReader.java 2001/03/12 05:55:23 1.1.2.6
@@ -29,7 +29,7 @@
import java.sql.Timestamp;
import java.sql.SQLException;
import java.io.InputStream;
-import java.io.OutputStream;
+import java.io.BufferedInputStream;
import java.io.IOException;
import java.util.Date;
1.1.2.22 +3 -3 xml-cocoon/src/org/apache/cocoon/reading/Attic/ResourceReader.java
Index: ResourceReader.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/reading/Attic/ResourceReader.java,v
retrieving revision 1.1.2.21
retrieving revision 1.1.2.22
diff -u -r1.1.2.21 -r1.1.2.22
--- ResourceReader.java 2001/03/03 17:17:21 1.1.2.21
+++ ResourceReader.java 2001/03/12 05:55:23 1.1.2.22
@@ -8,10 +8,10 @@
package org.apache.cocoon.reading;
import java.io.IOException;
-import java.io.OutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
+import java.io.BufferedInputStream;
import java.net.URL;
import java.net.MalformedURLException;
import java.net.URLConnection;
@@ -38,7 +38,7 @@
/**
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.21 $ $Date: 2001/03/03 17:17:21 $
+ * @version CVS $Revision: 1.1.2.22 $ $Date: 2001/03/12 05:55:23 $
*
* The <code>ResourceReader</code> component is used to serve binary data
* in a sitemap pipeline. It makes use of HTTP Headers to determine if
@@ -114,7 +114,7 @@
}
len = file.length();
- is = new FileInputStream (file);
+ is = new BufferedInputStream(new FileInputStream (file));
}
} catch (SAXException se) {
getLogger().error("ResourceReader: error resolving source \"" + source + "\"", se);
No revision
No revision
1.1.2.11 +3 -2 xml-cocoon/src/org/apache/cocoon/serialization/Attic/AbstractSerializer.java
Index: AbstractSerializer.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/serialization/Attic/AbstractSerializer.java,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -u -r1.1.2.10 -r1.1.2.11
--- AbstractSerializer.java 2001/02/16 22:07:42 1.1.2.10
+++ AbstractSerializer.java 2001/03/12 05:55:23 1.1.2.11
@@ -9,6 +9,7 @@
package org.apache.cocoon.serialization;
import java.io.OutputStream;
+import java.io.BufferedOutputStream;
import org.apache.avalon.Recyclable;
import org.apache.cocoon.xml.AbstractXMLPipe;
@@ -16,7 +17,7 @@
* @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.2.10 $ $Date: 2001/02/16 22:07:42 $
+ * @version CVS $Revision: 1.1.2.11 $ $Date: 2001/03/12 05:55:23 $
*/
public abstract class AbstractSerializer extends AbstractXMLPipe implements Serializer, Recyclable {
@@ -30,7 +31,7 @@
* Set the <code>OutputStream</code> where the XML should be serialized.
*/
public void setOutputStream(OutputStream out) {
- this.output = out;
+ this.output = new BufferedOutputStream(out);
}
/**
No revision
No revision
1.1.2.27 +1 -2 xml-cocoon/src/org/apache/cocoon/sitemap/Attic/AbstractSitemap.java
Index: AbstractSitemap.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/AbstractSitemap.java,v
retrieving revision 1.1.2.26
retrieving revision 1.1.2.27
diff -u -r1.1.2.26 -r1.1.2.27
--- AbstractSitemap.java 2001/03/12 05:18:07 1.1.2.26
+++ AbstractSitemap.java 2001/03/12 05:55:23 1.1.2.27
@@ -10,7 +10,6 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
@@ -42,7 +41,7 @@
* Base class for generated <code>Sitemap</code> classes
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.26 $ $Date: 2001/03/12 05:18:07 $
+ * @version CVS $Revision: 1.1.2.27 $ $Date: 2001/03/12 05:55:23 $
*/
public abstract class AbstractSitemap extends AbstractLoggable implements Sitemap {
private Context context;
1.1.2.20 +1 -2 xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Handler.java
Index: Handler.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Handler.java,v
retrieving revision 1.1.2.19
retrieving revision 1.1.2.20
diff -u -r1.1.2.19 -r1.1.2.20
--- Handler.java 2001/03/12 04:39:06 1.1.2.19
+++ Handler.java 2001/03/12 05:55:23 1.1.2.20
@@ -11,7 +11,6 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.io.OutputStream;
import java.net.URL;
@@ -41,7 +40,7 @@
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.2.19 $ $Date: 2001/03/12 04:39:06 $
+ * @version CVS $Revision: 1.1.2.20 $ $Date: 2001/03/12 05:55:23 $
*/
public class Handler extends AbstractLoggable implements Runnable, Configurable, Composer, Contextualizable, Processor {
private Context context;
1.1.2.13 +1 -2 xml-cocoon/src/org/apache/cocoon/sitemap/Attic/LinkTranslator.java
Index: LinkTranslator.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/LinkTranslator.java,v
retrieving revision 1.1.2.12
retrieving revision 1.1.2.13
diff -u -r1.1.2.12 -r1.1.2.13
--- LinkTranslator.java 2001/02/15 20:30:28 1.1.2.12
+++ LinkTranslator.java 2001/03/12 05:55:24 1.1.2.13
@@ -8,7 +8,6 @@
package org.apache.cocoon.sitemap;
-import java.io.OutputStream;
import java.io.PrintStream;
import java.io.IOException;
@@ -30,7 +29,7 @@
/**
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.2.12 $ $Date: 2001/02/15 20:30:28 $
+ * @version CVS $Revision: 1.1.2.13 $ $Date: 2001/03/12 05:55:24 $
*/
public class LinkTranslator extends ExtendedXLinkPipe implements Transformer {
1.1.2.11 +1 -2 xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Manager.java
Index: Manager.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Manager.java,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -u -r1.1.2.10 -r1.1.2.11
--- Manager.java 2001/03/12 04:39:07 1.1.2.10
+++ Manager.java 2001/03/12 05:55:24 1.1.2.11
@@ -10,7 +10,6 @@
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.io.OutputStream;
import java.net.MalformedURLException;
import java.util.Iterator;
import java.util.HashMap;
@@ -37,7 +36,7 @@
* checking regeneration of the sub <code>Sitemap</code>
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.10 $ $Date: 2001/03/12 04:39:07 $
+ * @version CVS $Revision: 1.1.2.11 $ $Date: 2001/03/12 05:55:24 $
*/
public class Manager extends AbstractLoggable implements Configurable, Composer, Contextualizable {
No revision
No revision
1.1.2.10 +4 -2 xml-cocoon/src/org/apache/cocoon/transformation/Attic/I18nTransformer.java
Index: I18nTransformer.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/I18nTransformer.java,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -r1.1.2.9 -r1.1.2.10
--- I18nTransformer.java 2001/02/22 19:08:18 1.1.2.9
+++ I18nTransformer.java 2001/03/12 05:55:25 1.1.2.10
@@ -30,8 +30,10 @@
import org.xml.sax.helpers.DefaultHandler;
import java.io.InputStream;
+import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.Reader;
+import java.io.BufferedReader;
import java.util.Map;
import java.util.Hashtable;
@@ -318,9 +320,9 @@
((Loggable)object).setLogger(getLogger());
}
if (object instanceof Reader) {
- input = new InputSource((Reader)(object));
+ input = new InputSource(new BufferedReader((Reader)(object)));
} else if (object instanceof InputStream) {
- input = new InputSource((InputStream)(object));
+ input = new InputSource(new BufferedInputStream((InputStream)(object)));
} else {
throw new SAXException("Unknown object type: " + object);
}
1.1.2.22 +8 -5 xml-cocoon/src/org/apache/cocoon/transformation/Attic/XIncludeTransformer.java
Index: XIncludeTransformer.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/XIncludeTransformer.java,v
retrieving revision 1.1.2.21
retrieving revision 1.1.2.22
diff -u -r1.1.2.21 -r1.1.2.22
--- XIncludeTransformer.java 2001/02/23 14:01:28 1.1.2.21
+++ XIncludeTransformer.java 2001/03/12 05:55:25 1.1.2.22
@@ -13,6 +13,8 @@
import java.io.Reader;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.BufferedReader;
+import java.io.BufferedInputStream;
import java.util.Stack;
import java.util.Map;
import org.xml.sax.Attributes;
@@ -49,7 +51,7 @@
* by the SAX event FSM yet.
*
* @author <a href="mailto:balld@webslingerZ.com">Donald Ball</a>
- * @version CVS $Revision: 1.1.2.21 $ $Date: 2001/02/23 14:01:28 $ $Author: dims $
+ * @version CVS $Revision: 1.1.2.22 $ $Date: 2001/03/12 05:55:25 $ $Author: bloritsch $
*/
public class XIncludeTransformer extends AbstractTransformer implements Composer, Poolable {
@@ -198,7 +200,7 @@
((Loggable)object).setLogger(getLogger());
}
if (object instanceof Reader) {
- Reader reader = (Reader)object;
+ Reader reader = new BufferedReader((Reader)object);
int read;
char ary[] = new char[1024];
if (reader != null) {
@@ -209,7 +211,7 @@
}
} else if (object instanceof InputStream) {
InputStream input = (InputStream)object;
- InputStreamReader reader = new InputStreamReader(input);
+ Reader reader = new BufferedReader(new InputStreamReader(input));
int read;
char ary[] = new char[1024];
if (reader != null) {
@@ -234,9 +236,9 @@
((Loggable)object).setLogger(getLogger());
}
if (object instanceof Reader) {
- input = new InputSource((Reader)object);
+ input = new InputSource(new BufferedReader((Reader)object));
} else if (object instanceof InputStream) {
- input = new InputSource((InputStream)object);
+ input = new InputSource(new BufferedInputStream((InputStream)object));
} else {
throw new SAXException("Unknown object type: "+object);
}
@@ -247,6 +249,7 @@
parser.setContentHandler(builder);
parser.setLexicalHandler(builder);
parser.parse(input);
+
Document document = builder.getDocument();
try {
NodeList list = XPathAPI.selectNodeList(document,xpath);
No revision
No revision
1.1.2.16 +5 -3 xml-cocoon/src/org/apache/cocoon/util/Attic/IOUtils.java
Index: IOUtils.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/util/Attic/IOUtils.java,v
retrieving revision 1.1.2.15
retrieving revision 1.1.2.16
diff -u -r1.1.2.15 -r1.1.2.16
--- IOUtils.java 2001/03/02 22:05:55 1.1.2.15
+++ IOUtils.java 2001/03/12 05:55:25 1.1.2.16
@@ -12,8 +12,10 @@
import java.io.FileReader;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
+import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
+import java.io.BufferedInputStream;
import java.io.IOException;
import java.text.Collator;
@@ -28,7 +30,7 @@
*
* @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
* @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.2.15 $ $Date: 2001/03/02 22:05:55 $
+ * @version CVS $Revision: 1.1.2.16 $ $Date: 2001/03/12 05:55:25 $
*/
public class IOUtils {
@@ -86,7 +88,7 @@
throws IOException
{
FileOutputStream fos = new FileOutputStream(file);
- ObjectOutputStream oos = new ObjectOutputStream(fos);
+ ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(fos));
oos.writeObject(object);
oos.flush();
fos.close();
@@ -103,7 +105,7 @@
throws IOException, ClassNotFoundException
{
FileInputStream fis = new FileInputStream(file);
- ObjectInputStream ois = new ObjectInputStream(fis);
+ ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(fis));
Object object = ois.readObject();
fis.close();
return object;
No revision
No revision
1.1.2.2 +2 -3 xml-cocoon/src/org/apache/cocoon/util/url/context/Attic/Handler.java
Index: Handler.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/util/url/context/Attic/Handler.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- Handler.java 2001/01/31 15:03:59 1.1.2.1
+++ Handler.java 2001/03/12 05:55:25 1.1.2.2
@@ -11,7 +11,6 @@
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
-import java.io.InputStream;
import java.io.IOException;
import java.io.FileNotFoundException;
import javax.servlet.ServletContext;
@@ -21,7 +20,7 @@
*
* @author: <a href="mailto:ovidiu@cup.hp.com">Ovidiu Predescu</a>
* @author: <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/01/31 15:03:59 $
+ * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/03/12 05:55:25 $
*/
public class Handler extends URLStreamHandler {
@@ -69,4 +68,4 @@
return connection;
}
-}
\ No newline at end of file
+}
No revision
No revision
1.1.2.2 +1 -2 xml-cocoon/src/org/apache/cocoon/util/url/resource/Attic/Handler.java
Index: Handler.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/util/url/resource/Attic/Handler.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- Handler.java 2001/01/31 15:04:00 1.1.2.1
+++ Handler.java 2001/03/12 05:55:27 1.1.2.2
@@ -11,7 +11,6 @@
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
-import java.io.InputStream;
import java.io.IOException;
import java.io.FileNotFoundException;
import org.apache.cocoon.util.ClassUtils;
@@ -23,7 +22,7 @@
*
* @author: <a href="mailto:ovidiu@cup.hp.com">Ovidiu Predescu</a>
* @author: <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
- * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/01/31 15:04:00 $
+ * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/03/12 05:55:27 $
*/
public class Handler extends URLStreamHandler implements Loggable {
private Logger log;
No revision
No revision
1.1.2.2 +140 -140 xml-cocoon/src/org/apache/cocoon/xml/Attic/CompiledXMLInputStream.java
Index: CompiledXMLInputStream.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/xml/Attic/CompiledXMLInputStream.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- CompiledXMLInputStream.java 2001/01/23 17:20:35 1.1.2.1
+++ CompiledXMLInputStream.java 2001/03/12 05:55:27 1.1.2.2
@@ -1,140 +1,140 @@
-/**
- ****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- ****************************************************************************
- */
-package org.apache.cocoon.xml;
-
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.EOFException;
-import java.io.UTFDataFormatException;
-
-import java.util.ArrayList;
-
-/**
- * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- */
-
-public final class CompiledXMLInputStream extends InputStream {
-
- private InputStream in;
- private ArrayList list = new ArrayList();
-
- public CompiledXMLInputStream(InputStream input) throws IOException {
- this.in = new FastInputStream(input, 1 << 13);
- this.checkProlog();
- }
-
- public final void checkProlog() throws IOException {
- InputStream in = this.in;
- int valid = 0;
- if (in.read() == 'C') valid++;
- if (in.read() == 'X') valid++;
- if (in.read() == 'M') valid++;
- if (in.read() == 'L') valid++;
- if (in.read() == 1) valid++;
- if (in.read() == 0) valid++;
- if (valid != 6) throw new IOException("Unrecognized file format.");
- }
-
- public final int readEvent() throws IOException {
- return this.in.read();
- }
-
- public final int readAttributes() throws IOException {
- InputStream in = this.in;
- int ch1 = in.read();
- int ch2 = in.read();
- return ((ch1 << 8) + (ch2 << 0));
- }
-
- public final String readString() throws IOException {
- int length = this.readLength();
- int index = length & 0x00007FFF;
- if (length >= 0x00008000) {
- return (String) list.get(index);
- } else {
- String str = new String(this.readChars(index));
- list.add(str);
- return str;
- }
- }
-
- /**
- * The returned char array might contain any number of zero bytes
- * at the end
- */
- public final char[] readChars() throws IOException {
- return readChars(this.readLength());
- }
-
- public final int read() throws IOException {
- return this.in.read();
- }
-
- /**
- * The returned char array might contain any number of zero bytes
- * at the end
- */
- private char[] readChars(int len) throws IOException {
- char[] str = new char[len];
- byte[] bytearr = new byte[len];
- int c, char2, char3;
- int count = 0;
- int i = 0;
-
- this.readBytes(bytearr);
-
- while (count < len) {
- c = (int) bytearr[count] & 0xff;
- switch (c >> 4) {
- case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
- /* 0xxxxxxx*/
- count++;
- str[i++] = (char) c;
- break;
- case 12: case 13:
- /* 110x xxxx 10xx xxxx*/
- count += 2;
- char2 = (int) bytearr[count-1];
- str[i++] = (char) (((c & 0x1F) << 6) | (char2 & 0x3F));
- break;
- case 14:
- /* 1110 xxxx 10xx xxxx 10xx xxxx */
- count += 3;
- char2 = (int) bytearr[count-2];
- char3 = (int) bytearr[count-1];
- str[i++] = ((char)(((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0)));
- break;
- default:
- /* 10xx xxxx, 1111 xxxx */
- throw new UTFDataFormatException();
- }
- }
-
- return str;
- }
-
- private void readBytes(byte[] b) throws IOException {
- InputStream in = this.in;
- int n = 0;
- int len = b.length;
- while (n < len) {
- int count = in.read(b, n, len - n);
- if (count < 0) throw new EOFException();
- n += count;
- }
- }
-
- private int readLength() throws IOException {
- InputStream in = this.in;
- int ch1 = in.read();
- int ch2 = in.read();
- return ((ch1 << 8) + (ch2 << 0));
- }
-}
+/**
+ ****************************************************************************
+ * Copyright (C) The Apache Software Foundation. All rights reserved. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
+ ****************************************************************************
+ */
+package org.apache.cocoon.xml;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.EOFException;
+import java.io.UTFDataFormatException;
+
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
+ */
+
+public final class CompiledXMLInputStream extends InputStream {
+
+ private InputStream in;
+ private ArrayList list = new ArrayList();
+
+ public CompiledXMLInputStream(InputStream input) throws IOException {
+ this.in = new FastInputStream(input, 1 << 13);
+ this.checkProlog();
+ }
+
+ public final void checkProlog() throws IOException {
+ InputStream in = this.in;
+ int valid = 0;
+ if (in.read() == 'C') valid++;
+ if (in.read() == 'X') valid++;
+ if (in.read() == 'M') valid++;
+ if (in.read() == 'L') valid++;
+ if (in.read() == 1) valid++;
+ if (in.read() == 0) valid++;
+ if (valid != 6) throw new IOException("Unrecognized file format.");
+ }
+
+ public final int readEvent() throws IOException {
+ return this.in.read();
+ }
+
+ public final int readAttributes() throws IOException {
+ InputStream in = this.in;
+ int ch1 = in.read();
+ int ch2 = in.read();
+ return ((ch1 << 8) + (ch2 << 0));
+ }
+
+ public final String readString() throws IOException {
+ int length = this.readLength();
+ int index = length & 0x00007FFF;
+ if (length >= 0x00008000) {
+ return (String) list.get(index);
+ } else {
+ String str = new String(this.readChars(index));
+ list.add(str);
+ return str;
+ }
+ }
+
+ /**
+ * The returned char array might contain any number of zero bytes
+ * at the end
+ */
+ public final char[] readChars() throws IOException {
+ return readChars(this.readLength());
+ }
+
+ public final int read() throws IOException {
+ return this.in.read();
+ }
+
+ /**
+ * The returned char array might contain any number of zero bytes
+ * at the end
+ */
+ private char[] readChars(int len) throws IOException {
+ char[] str = new char[len];
+ byte[] bytearr = new byte[len];
+ int c, char2, char3;
+ int count = 0;
+ int i = 0;
+
+ this.readBytes(bytearr);
+
+ while (count < len) {
+ c = (int) bytearr[count] & 0xff;
+ switch (c >> 4) {
+ case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
+ /* 0xxxxxxx*/
+ count++;
+ str[i++] = (char) c;
+ break;
+ case 12: case 13:
+ /* 110x xxxx 10xx xxxx*/
+ count += 2;
+ char2 = (int) bytearr[count-1];
+ str[i++] = (char) (((c & 0x1F) << 6) | (char2 & 0x3F));
+ break;
+ case 14:
+ /* 1110 xxxx 10xx xxxx 10xx xxxx */
+ count += 3;
+ char2 = (int) bytearr[count-2];
+ char3 = (int) bytearr[count-1];
+ str[i++] = ((char)(((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0)));
+ break;
+ default:
+ /* 10xx xxxx, 1111 xxxx */
+ throw new UTFDataFormatException();
+ }
+ }
+
+ return str;
+ }
+
+ private void readBytes(byte[] b) throws IOException {
+ InputStream in = this.in;
+ int n = 0;
+ int len = b.length;
+ while (n < len) {
+ int count = in.read(b, n, len - n);
+ if (count < 0) throw new EOFException();
+ n += count;
+ }
+ }
+
+ private int readLength() throws IOException {
+ InputStream in = this.in;
+ int ch1 = in.read();
+ int ch2 = in.read();
+ return ((ch1 << 8) + (ch2 << 0));
+ }
+}
1.1.2.2 +102 -102 xml-cocoon/src/org/apache/cocoon/xml/Attic/CompiledXMLOutputStream.java
Index: CompiledXMLOutputStream.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/xml/Attic/CompiledXMLOutputStream.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- CompiledXMLOutputStream.java 2001/01/23 17:20:38 1.1.2.1
+++ CompiledXMLOutputStream.java 2001/03/12 05:55:27 1.1.2.2
@@ -1,102 +1,102 @@
-/**
- ****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- ****************************************************************************
- */
-package org.apache.cocoon.xml;
-
-import java.io.OutputStream;
-import java.io.IOException;
-import java.io.UTFDataFormatException;
-
-import java.util.HashMap;
-
-/**
- * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- */
-
-public final class CompiledXMLOutputStream extends OutputStream {
-
- private OutputStream out;
- private HashMap map = new HashMap();
- private int count = 0;
-
- public CompiledXMLOutputStream(OutputStream out) throws IOException {
- this.out = out;
- out.write('C');
- out.write('X');
- out.write('M');
- out.write('L');
- out.write(1);
- out.write(0);
- }
-
- public final void writeEvent(int event) throws IOException {
- this.out.write(event);
- }
-
- public final void writeAttributes(int attributes) throws IOException {
- OutputStream out = this.out;
- out.write((attributes >>> 8) & 0xFF);
- out.write((attributes >>> 0) & 0xFF);
- }
-
- public final void writeString(String str) throws IOException {
- Integer index = (Integer) map.get(str);
- if (index == null) {
- int length = str.length();
- map.put(str, new Integer(count++));
- if (length > (2 << 15)) throw new IOException("String cannot be bigger than 32K");
- this.writeChars(str.toCharArray(), 0, length);
- } else {
- int i = index.intValue();
- this.out.write(((i >>> 8) & 0xFF) | 0x80);
- this.out.write((i >>> 0) & 0xFF);
- }
- }
-
- public final void writeChars(char[] ch, int start, int length) throws IOException {
- int utflen = 0;
- int c, count = 0;
-
- for (int i = 0; i < length; i++) {
- c = ch[i + start];
- if ((c >= 0x0001) && (c <= 0x007F)) {
- utflen++;
- } else if (c > 0x07FF) {
- utflen += 3;
- } else {
- utflen += 2;
- }
- }
-
- if (utflen > 65535) throw new UTFDataFormatException();
-
- byte[] bytearr = new byte[utflen+2];
- bytearr[count++] = (byte) ((utflen >>> 8) & 0xFF);
- bytearr[count++] = (byte) ((utflen >>> 0) & 0xFF);
- for (int i = 0; i < length; i++) {
- c = ch[i + start];
- if ((c >= 0x0001) && (c <= 0x007F)) {
- bytearr[count++] = (byte) c;
- } else if (c > 0x07FF) {
- bytearr[count++] = (byte) (0xE0 | ((c >> 12) & 0x0F));
- bytearr[count++] = (byte) (0x80 | ((c >> 6) & 0x3F));
- bytearr[count++] = (byte) (0x80 | ((c >> 0) & 0x3F));
- } else {
- bytearr[count++] = (byte) (0xC0 | ((c >> 6) & 0x1F));
- bytearr[count++] = (byte) (0x80 | ((c >> 0) & 0x3F));
- }
- }
-
- this.out.write(bytearr);
- }
-
- public final void write(int c) throws IOException {
- this.out.write(c);
- }
-}
+/**
+ ****************************************************************************
+ * Copyright (C) The Apache Software Foundation. All rights reserved. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
+ ****************************************************************************
+ */
+package org.apache.cocoon.xml;
+
+import java.io.OutputStream;
+import java.io.IOException;
+import java.io.UTFDataFormatException;
+
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
+ */
+
+public final class CompiledXMLOutputStream extends OutputStream {
+
+ private OutputStream out;
+ private HashMap map = new HashMap();
+ private int count = 0;
+
+ public CompiledXMLOutputStream(OutputStream out) throws IOException {
+ this.out = out;
+ out.write('C');
+ out.write('X');
+ out.write('M');
+ out.write('L');
+ out.write(1);
+ out.write(0);
+ }
+
+ public final void writeEvent(int event) throws IOException {
+ this.out.write(event);
+ }
+
+ public final void writeAttributes(int attributes) throws IOException {
+ OutputStream out = this.out;
+ out.write((attributes >>> 8) & 0xFF);
+ out.write((attributes >>> 0) & 0xFF);
+ }
+
+ public final void writeString(String str) throws IOException {
+ Integer index = (Integer) map.get(str);
+ if (index == null) {
+ int length = str.length();
+ map.put(str, new Integer(count++));
+ if (length > (2 << 15)) throw new IOException("String cannot be bigger than 32K");
+ this.writeChars(str.toCharArray(), 0, length);
+ } else {
+ int i = index.intValue();
+ this.out.write(((i >>> 8) & 0xFF) | 0x80);
+ this.out.write((i >>> 0) & 0xFF);
+ }
+ }
+
+ public final void writeChars(char[] ch, int start, int length) throws IOException {
+ int utflen = 0;
+ int c, count = 0;
+
+ for (int i = 0; i < length; i++) {
+ c = ch[i + start];
+ if ((c >= 0x0001) && (c <= 0x007F)) {
+ utflen++;
+ } else if (c > 0x07FF) {
+ utflen += 3;
+ } else {
+ utflen += 2;
+ }
+ }
+
+ if (utflen > 65535) throw new UTFDataFormatException();
+
+ byte[] bytearr = new byte[utflen+2];
+ bytearr[count++] = (byte) ((utflen >>> 8) & 0xFF);
+ bytearr[count++] = (byte) ((utflen >>> 0) & 0xFF);
+ for (int i = 0; i < length; i++) {
+ c = ch[i + start];
+ if ((c >= 0x0001) && (c <= 0x007F)) {
+ bytearr[count++] = (byte) c;
+ } else if (c > 0x07FF) {
+ bytearr[count++] = (byte) (0xE0 | ((c >> 12) & 0x0F));
+ bytearr[count++] = (byte) (0x80 | ((c >> 6) & 0x3F));
+ bytearr[count++] = (byte) (0x80 | ((c >> 0) & 0x3F));
+ } else {
+ bytearr[count++] = (byte) (0xC0 | ((c >> 6) & 0x1F));
+ bytearr[count++] = (byte) (0x80 | ((c >> 0) & 0x3F));
+ }
+ }
+
+ this.out.write(bytearr);
+ }
+
+ public final void write(int c) throws IOException {
+ this.out.write(c);
+ }
+}
1.1.2.2 +114 -114 xml-cocoon/src/org/apache/cocoon/xml/Attic/FastInputStream.java
Index: FastInputStream.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/xml/Attic/FastInputStream.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- FastInputStream.java 2001/01/23 17:20:40 1.1.2.1
+++ FastInputStream.java 2001/03/12 05:55:27 1.1.2.2
@@ -1,114 +1,114 @@
-/**
- ****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- ****************************************************************************
- */
-package org.apache.cocoon.xml;
-
-import java.io.InputStream;
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- */
-
-public class FastInputStream extends InputStream {
-
- private static final int DEFAULT_SIZE = 2048;
-
- private InputStream in;
- private byte buf[];
- private int count;
- private int pos;
- private int markpos = -1;
- private int marklimit;
-
- public FastInputStream(InputStream in) {
- this(in, DEFAULT_SIZE);
- }
-
- public FastInputStream(InputStream in, int size) {
- if (size <= 0) {
- throw new IllegalArgumentException("Buffer size <= 0");
- }
- this.in = in;
- this.buf = new byte[size];
- }
-
- private void fill() throws IOException {
- if (markpos < 0) {
- pos = 0;
- } else if (pos >= buf.length) {
- if (markpos > 0) {
- int sz = pos - markpos;
- System.arraycopy(buf, markpos, buf, 0, sz);
- pos = sz;
- markpos = 0;
- } else if (buf.length >= marklimit) {
- markpos = -1;
- pos = 0;
- } else {
- int nsz = pos * 2;
- if (nsz > marklimit) nsz = marklimit;
- byte nbuf[] = new byte[nsz];
- System.arraycopy(buf, 0, nbuf, 0, pos);
- buf = nbuf;
- }
- }
- count = pos;
- int n = in.read(buf, pos, buf.length - pos);
- if (n > 0) count = n + pos;
- }
-
- public final int read() throws IOException {
- if (pos >= count) {
- fill();
- if (pos >= count) return -1;
- }
- return buf[pos++] & 0xff;
- }
-
- private int read1(byte[] b, int off, int len) throws IOException {
- int avail = count - pos;
- if (avail <= 0) {
- if (len >= buf.length && markpos < 0) {
- return in.read(b, off, len);
- }
- fill();
- avail = count - pos;
- if (avail <= 0) return -1;
- }
- int cnt = (avail < len) ? avail : len;
- System.arraycopy(buf, pos, b, off, cnt);
- pos += cnt;
- return cnt;
- }
-
- public final int read(byte b[], int off, int len) throws IOException {
- if ((off | len | (off + len) | (b.length - (off + len))) < 0) {
- throw new IndexOutOfBoundsException();
- } else if (len == 0) {
- return 0;
- }
-
- int n = read1(b, off, len);
- if (n <= 0) return n;
- while ((n < len) && (in.available() > 0)) {
- int n1 = read1(b, off + n, len - n);
- if (n1 <= 0) break;
- n += n1;
- }
- return n;
- }
-
- public final void close() throws IOException {
- if (in == null) return;
- in.close();
- in = null;
- buf = null;
- }
-}
+/**
+ ****************************************************************************
+ * Copyright (C) The Apache Software Foundation. All rights reserved. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
+ ****************************************************************************
+ */
+package org.apache.cocoon.xml;
+
+import java.io.InputStream;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
+ */
+
+public class FastInputStream extends InputStream {
+
+ private static final int DEFAULT_SIZE = 2048;
+
+ private InputStream in;
+ private byte buf[];
+ private int count;
+ private int pos;
+ private int markpos = -1;
+ private int marklimit;
+
+ public FastInputStream(InputStream in) {
+ this(in, DEFAULT_SIZE);
+ }
+
+ public FastInputStream(InputStream in, int size) {
+ if (size <= 0) {
+ throw new IllegalArgumentException("Buffer size <= 0");
+ }
+ this.in = in;
+ this.buf = new byte[size];
+ }
+
+ private void fill() throws IOException {
+ if (markpos < 0) {
+ pos = 0;
+ } else if (pos >= buf.length) {
+ if (markpos > 0) {
+ int sz = pos - markpos;
+ System.arraycopy(buf, markpos, buf, 0, sz);
+ pos = sz;
+ markpos = 0;
+ } else if (buf.length >= marklimit) {
+ markpos = -1;
+ pos = 0;
+ } else {
+ int nsz = pos * 2;
+ if (nsz > marklimit) nsz = marklimit;
+ byte nbuf[] = new byte[nsz];
+ System.arraycopy(buf, 0, nbuf, 0, pos);
+ buf = nbuf;
+ }
+ }
+ count = pos;
+ int n = in.read(buf, pos, buf.length - pos);
+ if (n > 0) count = n + pos;
+ }
+
+ public final int read() throws IOException {
+ if (pos >= count) {
+ fill();
+ if (pos >= count) return -1;
+ }
+ return buf[pos++] & 0xff;
+ }
+
+ private int read1(byte[] b, int off, int len) throws IOException {
+ int avail = count - pos;
+ if (avail <= 0) {
+ if (len >= buf.length && markpos < 0) {
+ return in.read(b, off, len);
+ }
+ fill();
+ avail = count - pos;
+ if (avail <= 0) return -1;
+ }
+ int cnt = (avail < len) ? avail : len;
+ System.arraycopy(buf, pos, b, off, cnt);
+ pos += cnt;
+ return cnt;
+ }
+
+ public final int read(byte b[], int off, int len) throws IOException {
+ if ((off | len | (off + len) | (b.length - (off + len))) < 0) {
+ throw new IndexOutOfBoundsException();
+ } else if (len == 0) {
+ return 0;
+ }
+
+ int n = read1(b, off, len);
+ if (n <= 0) return n;
+ while ((n < len) && (in.available() > 0)) {
+ int n1 = read1(b, off + n, len - n);
+ if (n1 <= 0) break;
+ n += n1;
+ }
+ return n;
+ }
+
+ public final void close() throws IOException {
+ if (in == null) return;
+ in.close();
+ in = null;
+ buf = null;
+ }
+}
1.1.2.2 +160 -160 xml-cocoon/src/org/apache/cocoon/xml/Attic/XMLInterpreter.java
Index: XMLInterpreter.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/xml/Attic/XMLInterpreter.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- XMLInterpreter.java 2001/01/23 17:20:45 1.1.2.1
+++ XMLInterpreter.java 2001/03/12 05:55:27 1.1.2.2
@@ -1,160 +1,160 @@
-/**
- ****************************************************************************
- * Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
- ****************************************************************************
- */
-package org.apache.cocoon.xml;
-
-import java.io.FileInputStream;
-import java.io.BufferedInputStream;
-import java.io.InputStream;
-import java.io.IOException;
-
-import java.util.HashMap;
-
-import org.xml.sax.XMLReader;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.helpers.AttributesImpl;
-
-/**
- * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/01/23 17:20:45 $
- */
-
-public final class XMLInterpreter implements XMLReader {
-
- public static final int START_DOCUMENT = 0;
- public static final int END_DOCUMENT = 1;
- public static final int START_PREFIX_MAPPING = 2;
- public static final int END_PREFIX_MAPPING = 3;
- public static final int START_ELEMENT = 4;
- public static final int END_ELEMENT = 5;
- public static final int CHARACTERS = 6;
- public static final int IGNORABLE_WHITESPACE = 7;
- public static final int PROCESSING_INSTRUCTION = 8;
-
- private ContentHandler contentHandler;
- private DTDHandler dtdHandler;
- private EntityResolver entityResolver;
- private ErrorHandler errorHandler;
-
- private HashMap features = new HashMap();
- private HashMap properties = new HashMap();
-
- public ContentHandler getContentHandler() {
- return this.contentHandler;
- }
-
- public DTDHandler getDTDHandler() {
- return this.dtdHandler;
- }
-
- public EntityResolver getEntityResolver() {
- return this.entityResolver;
- }
-
- public ErrorHandler getErrorHandler() {
- return this.errorHandler;
- }
-
- public void setContentHandler(ContentHandler handler) {
- this.contentHandler = handler;
- }
-
- public void setDTDHandler(DTDHandler handler) {
- this.dtdHandler = handler;
- }
-
- public void setEntityResolver(EntityResolver resolver) {
- this.entityResolver = resolver;
- }
-
- public void setErrorHandler(ErrorHandler handler) {
- this.errorHandler = handler;
- }
-
- public boolean getFeature(java.lang.String name) throws SAXNotRecognizedException, SAXNotSupportedException {
- Object o = this.features.get(name);
- return ((o != null) && ((Boolean) o).booleanValue());
- }
-
- public Object getProperty(java.lang.String name) throws SAXNotRecognizedException, SAXNotSupportedException {
- return this.properties.get(name);
- }
-
- public void setFeature(java.lang.String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
- this.features.put(name, new Boolean(value));
- }
-
- public void setProperty(java.lang.String name, java.lang.Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
- this.properties.put(name, value);
- }
-
- public void parse(java.lang.String systemId) throws IOException, SAXException {
- parse(new FileInputStream(systemId));
- }
-
- public void parse(InputSource in) throws IOException, SAXException {
- parse(in.getByteStream());
- }
-
- public void parse(InputStream stream) throws IOException, SAXException {
- CompiledXMLInputStream input = new CompiledXMLInputStream(stream);
-
- while (true) {
- switch (input.readEvent()) {
- case START_DOCUMENT:
- contentHandler.startDocument();
- break;
- case END_DOCUMENT:
- contentHandler.endDocument();
- return;
- case START_PREFIX_MAPPING:
- contentHandler.startPrefixMapping(input.readString(), input.readString());
- break;
- case END_PREFIX_MAPPING:
- contentHandler.endPrefixMapping(input.readString());
- break;
- case START_ELEMENT:
- int attributes = input.readAttributes();
- AttributesImpl atts = new AttributesImpl();
- for (int i = 0; i < attributes; i++) {
- atts.addAttribute(input.readString(), input.readString(), input.readString(), input.readString(), input.readString());
- }
- contentHandler.startElement(input.readString(), input.readString(), input.readString(), atts);
- break;
- case END_ELEMENT:
- contentHandler.endElement(input.readString(), input.readString(), input.readString());
- break;
- case CHARACTERS:
- char[] chars = input.readChars();
- int len = chars.length;
- while (chars[len-1]==0) len--;
- contentHandler.characters(chars, 0, len);
- break;
- case IGNORABLE_WHITESPACE:
- char[] spaces = input.readChars();
- len = spaces.length;
- while (spaces[len-1]==0) len--;
- contentHandler.characters(spaces, 0, len);
- break;
- case PROCESSING_INSTRUCTION:
- contentHandler.processingInstruction(input.readString(), input.readString());
- break;
- default:
- throw new IOException ("parsing error: event not supported.");
- }
- }
- }
-}
+/**
+ ****************************************************************************
+ * Copyright (C) The Apache Software Foundation. All rights reserved. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
+ ****************************************************************************
+ */
+package org.apache.cocoon.xml;
+
+import java.io.FileInputStream;
+import java.io.BufferedInputStream;
+import java.io.InputStream;
+import java.io.IOException;
+
+import java.util.HashMap;
+
+import org.xml.sax.XMLReader;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
+ * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/03/12 05:55:27 $
+ */
+
+public final class XMLInterpreter implements XMLReader {
+
+ public static final int START_DOCUMENT = 0;
+ public static final int END_DOCUMENT = 1;
+ public static final int START_PREFIX_MAPPING = 2;
+ public static final int END_PREFIX_MAPPING = 3;
+ public static final int START_ELEMENT = 4;
+ public static final int END_ELEMENT = 5;
+ public static final int CHARACTERS = 6;
+ public static final int IGNORABLE_WHITESPACE = 7;
+ public static final int PROCESSING_INSTRUCTION = 8;
+
+ private ContentHandler contentHandler;
+ private DTDHandler dtdHandler;
+ private EntityResolver entityResolver;
+ private ErrorHandler errorHandler;
+
+ private HashMap features = new HashMap();
+ private HashMap properties = new HashMap();
+
+ public ContentHandler getContentHandler() {
+ return this.contentHandler;
+ }
+
+ public DTDHandler getDTDHandler() {
+ return this.dtdHandler;
+ }
+
+ public EntityResolver getEntityResolver() {
+ return this.entityResolver;
+ }
+
+ public ErrorHandler getErrorHandler() {
+ return this.errorHandler;
+ }
+
+ public void setContentHandler(ContentHandler handler) {
+ this.contentHandler = handler;
+ }
+
+ public void setDTDHandler(DTDHandler handler) {
+ this.dtdHandler = handler;
+ }
+
+ public void setEntityResolver(EntityResolver resolver) {
+ this.entityResolver = resolver;
+ }
+
+ public void setErrorHandler(ErrorHandler handler) {
+ this.errorHandler = handler;
+ }
+
+ public boolean getFeature(java.lang.String name) throws SAXNotRecognizedException, SAXNotSupportedException {
+ Object o = this.features.get(name);
+ return ((o != null) && ((Boolean) o).booleanValue());
+ }
+
+ public Object getProperty(java.lang.String name) throws SAXNotRecognizedException, SAXNotSupportedException {
+ return this.properties.get(name);
+ }
+
+ public void setFeature(java.lang.String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
+ this.features.put(name, new Boolean(value));
+ }
+
+ public void setProperty(java.lang.String name, java.lang.Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
+ this.properties.put(name, value);
+ }
+
+ public void parse(java.lang.String systemId) throws IOException, SAXException {
+ parse(new BufferedInputStream(new FileInputStream(systemId)));
+ }
+
+ public void parse(InputSource in) throws IOException, SAXException {
+ parse(in.getByteStream());
+ }
+
+ public void parse(InputStream stream) throws IOException, SAXException {
+ CompiledXMLInputStream input = new CompiledXMLInputStream(stream);
+
+ while (true) {
+ switch (input.readEvent()) {
+ case START_DOCUMENT:
+ contentHandler.startDocument();
+ break;
+ case END_DOCUMENT:
+ contentHandler.endDocument();
+ return;
+ case START_PREFIX_MAPPING:
+ contentHandler.startPrefixMapping(input.readString(), input.readString());
+ break;
+ case END_PREFIX_MAPPING:
+ contentHandler.endPrefixMapping(input.readString());
+ break;
+ case START_ELEMENT:
+ int attributes = input.readAttributes();
+ AttributesImpl atts = new AttributesImpl();
+ for (int i = 0; i < attributes; i++) {
+ atts.addAttribute(input.readString(), input.readString(), input.readString(), input.readString(), input.readString());
+ }
+ contentHandler.startElement(input.readString(), input.readString(), input.readString(), atts);
+ break;
+ case END_ELEMENT:
+ contentHandler.endElement(input.readString(), input.readString(), input.readString());
+ break;
+ case CHARACTERS:
+ char[] chars = input.readChars();
+ int len = chars.length;
+ while (chars[len-1]==0) len--;
+ contentHandler.characters(chars, 0, len);
+ break;
+ case IGNORABLE_WHITESPACE:
+ char[] spaces = input.readChars();
+ len = spaces.length;
+ while (spaces[len-1]==0) len--;
+ contentHandler.characters(spaces, 0, len);
+ break;
+ case PROCESSING_INSTRUCTION:
+ contentHandler.processingInstruction(input.readString(), input.readString());
+ break;
+ default:
+ throw new IOException ("parsing error: event not supported.");
+ }
+ }
+ }
+}
----------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org