abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r521094 [1/4] - in /incubator/abdera/java/trunk: build/ client/src/test/java/org/apache/abdera/test/client/app/ core/src/main/java/org/apache/abdera/model/ core/src/main/java/org/apache/abdera/parser/ core/src/main/java/org/apache/abdera/ut...
Date Thu, 22 Mar 2007 03:00:33 GMT
Author: jmsnell
Date: Wed Mar 21 20:00:19 2007
New Revision: 521094

URL: http://svn.apache.org/viewvc?view=rev&rev=521094
Log:
Changed the very poorly named and nonsensical g14n package to a more appropriately and sensibly named i18n package

Also, fix a build bug from the recent changes to the slug sanitization code

Added:
    incubator/abdera/java/trunk/dependencies/i18n/
      - copied from r520460, incubator/abdera/java/trunk/dependencies/g14n/
    incubator/abdera/java/trunk/dependencies/i18n/src/
      - copied from r521092, incubator/abdera/java/trunk/dependencies/g14n/src/
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/ChainableBitSet.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/ByteArrayCodepointIterator.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharArrayCodepointIterator.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharBufferCodepointIterator.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharSequenceCodepointIterator.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharUtils.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CodepointIterator.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/DynamicPushbackInputStream.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/FilterCodepointIterator.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/InvalidCharacterException.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/PeekAheadInputStream.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/ReadWriteByteChannel.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/RestrictedCodepointIterator.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/RewindableInputStream.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/AbstractScheme.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Constants.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/DefaultScheme.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Escaping.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/HttpScheme.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/HttpsScheme.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/IDNA.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/IRI.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/IRISyntaxException.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Nameprep.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/NameprepCodepointIterator.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Punycode.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/Scheme.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/iri/SchemeRegistry.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/lang/
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/lang/InvalidLangTagSyntax.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/lang/Lang.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/unicode/
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/unicode/Normalizer.java
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/unicode/UnicodeCharacterDatabase.java
    incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/
    incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/
    incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/
    incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/TestBase.java
    incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/TestIDNA.java
    incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/TestIRI.java
    incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/TestLang.java
    incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/TestNFKC.java
    incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/TestNameprep.java
    incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/TestPunycode.java
    incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/i18n/test/iri/TestSuite.java
Removed:
    incubator/abdera/java/trunk/dependencies/g14n/
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/g14n/
    incubator/abdera/java/trunk/dependencies/i18n/src/test/java/org/apache/abdera/g14n/
Modified:
    incubator/abdera/java/trunk/build/build.xml
    incubator/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/app/AppTest.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Categories.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Category.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Collection.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Content.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Document.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Element.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/ElementWrapper.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Entry.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Feed.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Generator.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/IRIElement.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Link.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Person.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Source.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Workspace.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/Parser.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbderaResult.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbstractParser.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/URIHelper.java
    incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appclient/Main.java
    incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/appserver/SimpleProvider.java
    incubator/abdera/java/trunk/examples/src/main/java/org/apache/abdera/examples/simple/Create.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/bidi/BidiHelper.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/features/Control.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/features/Feature.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/features/FeaturesHelper.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/history/FeedPagingHelper.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/json/JSONWriter.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaCategory.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaContent.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaCopyright.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaCredit.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaPlayer.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaRating.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaThumbnail.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/thread/InReplyTo.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/thread/ThreadHelper.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategories.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCategory.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDiv.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDocument.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMSource.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMText.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWorkspace.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/util/ResolveFunction.java
    incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/AtomConformanceTest.java
    incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/BaseParserTestCase.java
    incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FOMTest.java
    incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FeedParserTest.java
    incubator/abdera/java/trunk/parser/src/test/java/org/apache/abdera/test/parser/stax/FeedValidatorTest.java
    incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/Response.java
    incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/AbstractResponse.java
    incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/EncodingUtil.java
    incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/servlet/SecurityFilter.java
    incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSignature.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/provider/AbstractProvider.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/provider/AbstractRequestContext.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/provider/RequestContext.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/servlet/HttpServletRequestContext.java
    incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/test/server/UtilityTest.java

Modified: incubator/abdera/java/trunk/build/build.xml
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/build/build.xml?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/build/build.xml (original)
+++ incubator/abdera/java/trunk/build/build.xml Wed Mar 21 20:00:19 2007
@@ -90,17 +90,17 @@
   <property name="json.version" value="1.0" />
   <property name="json.jar" value="${dependencies}/json-${json.version}.jar" />
 
-  <property name="g14n.src" value="${dependencies}/g14n/src" />
-  <property name="g14n.src.java" value="${g14n.src}/main/java" />
-  <property name="g14n.src.resources" value="${g14n.src}/main/resources" />
-  <property name="g14n.version" value="0.2.2" />
-  <property name="g14n.jar" value="${dependencies}/abdera-g14n-${g14n.version}.jar" />
+  <property name="i18n.src" value="${dependencies}/i18n/src" />
+  <property name="i18n.src.java" value="${i18n.src}/main/java" />
+  <property name="i18n.src.resources" value="${i18n.src}/main/resources" />
+  <property name="i18n.version" value="0.2.2" />
+  <property name="i18n.jar" value="${dependencies}/abdera-i18n-${i18n.version}.jar" />
 
   <property file="${dependencies}/deps.properties" />
 
   <path id="jar.dependencies">
     <fileset dir="${dependencies}" includes="**/*.jar" />
-    <fileset file="${g14n.jar}" />
+    <fileset file="${i18n.jar}" />
     <fileset file="${json.jar}" />
   </path>
 
@@ -113,12 +113,12 @@
     <jar destfile="${json.jar}" basedir="${dependencies.work}/json" includes="org/json/*.class" />
 
 
-    <mkdir dir="${dependencies.work}/g14n" />
-    <javac srcdir="${g14n.src.java}" destdir="${dependencies.work}/g14n" debug="${debug}" />
-    <copy todir="${dependencies.work}/g14n">
-      <fileset dir="${g14n.src.resources}" includes="**/*" />
+    <mkdir dir="${dependencies.work}/i18n" />
+    <javac srcdir="${i18n.src.java}" destdir="${dependencies.work}/i18n" debug="${debug}" />
+    <copy todir="${dependencies.work}/i18n">
+      <fileset dir="${i18n.src.resources}" includes="**/*" />
     </copy>
-    <jar destfile="${g14n.jar}" basedir="${dependencies.work}/g14n" includes="org/apache/abdera/g14n/**/*" />
+    <jar destfile="${i18n.jar}" basedir="${dependencies.work}/i18n" includes="org/apache/abdera/i18n/**/*" />
 
   </target>
 
@@ -356,7 +356,7 @@
     <delete dir="${dist}" />
     <delete dir="${dependencies.work}" />
     <delete file="${json.jar}" />
-    <delete file="${g14n.jar}" />
+    <delete file="${i18n.jar}" />
     <delete>
       <fileset dir="${basedir}" includes="*.zip" />
       <fileset dir="${basedir}" includes="*.md5" />

Modified: incubator/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/app/AppTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/app/AppTest.java?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/app/AppTest.java (original)
+++ incubator/abdera/java/trunk/client/src/test/java/org/apache/abdera/test/client/app/AppTest.java Wed Mar 21 20:00:19 2007
@@ -48,7 +48,7 @@
 import org.apache.abdera.protocol.client.ClientResponse;
 import org.apache.abdera.test.client.JettyTest;
 import org.apache.abdera.util.MimeTypeHelper;
-import org.apache.abdera.g14n.iri.IRI;
+import org.apache.abdera.i18n.iri.IRI;
 
 /**
  * Test to make sure that we can operate as a simple APP client

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Categories.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Categories.java?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Categories.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Categories.java Wed Mar 21 20:00:19 2007
@@ -19,8 +19,8 @@
 
 import java.util.List;
 
-import org.apache.abdera.g14n.iri.IRI;
-import org.apache.abdera.g14n.iri.IRISyntaxException;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.iri.IRISyntaxException;
 
 /**
  * The Atom Publishing Protocol introduces the notion of a "Category Document"

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Category.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Category.java?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Category.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Category.java Wed Mar 21 20:00:19 2007
@@ -17,8 +17,8 @@
 */
 package org.apache.abdera.model;
 
-import org.apache.abdera.g14n.iri.IRI;
-import org.apache.abdera.g14n.iri.IRISyntaxException;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.iri.IRISyntaxException;
 
 /**
  * <p>Provides categorization informaton for a feed or entry</p>

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Collection.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Collection.java?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Collection.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Collection.java Wed Mar 21 20:00:19 2007
@@ -21,8 +21,8 @@
 
 import javax.activation.MimeType;
 
-import org.apache.abdera.g14n.iri.IRI;
-import org.apache.abdera.g14n.iri.IRISyntaxException;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.iri.IRISyntaxException;
 
 /**
  * <p>Represents an collection element in an Atom Publishing Protocol 

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Content.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Content.java?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Content.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Content.java Wed Mar 21 20:00:19 2007
@@ -22,8 +22,8 @@
 import javax.activation.MimeTypeParseException;
 
 import org.apache.abdera.util.MimeTypeHelper;
-import org.apache.abdera.g14n.iri.IRI;
-import org.apache.abdera.g14n.iri.IRISyntaxException;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.iri.IRISyntaxException;
 
 /**
  * <p>Represents an atom:content element.</p>

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Document.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Document.java?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Document.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Document.java Wed Mar 21 20:00:19 2007
@@ -23,8 +23,8 @@
 import javax.activation.MimeType;
 import javax.activation.MimeTypeParseException;
 
-import org.apache.abdera.g14n.iri.IRI;
-import org.apache.abdera.g14n.iri.IRISyntaxException;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.iri.IRISyntaxException;
 
 /**
  * <p>The top level artifact of the Feed Object Model.  The Parser component

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Element.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Element.java?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Element.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Element.java Wed Mar 21 20:00:19 2007
@@ -22,10 +22,10 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.abdera.g14n.iri.IRI;
-import org.apache.abdera.g14n.iri.IRISyntaxException;
-import org.apache.abdera.g14n.lang.InvalidLangTagSyntax;
-import org.apache.abdera.g14n.lang.Lang;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.iri.IRISyntaxException;
+import org.apache.abdera.i18n.lang.InvalidLangTagSyntax;
+import org.apache.abdera.i18n.lang.Lang;
 
 /**
  * Root interface for all elements in the Feed Object Model

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/ElementWrapper.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/ElementWrapper.java?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/ElementWrapper.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/ElementWrapper.java Wed Mar 21 20:00:19 2007
@@ -26,10 +26,10 @@
 import javax.xml.namespace.QName;
 
 import org.apache.abdera.factory.Factory;
-import org.apache.abdera.g14n.iri.IRI;
-import org.apache.abdera.g14n.iri.IRISyntaxException;
-import org.apache.abdera.g14n.lang.InvalidLangTagSyntax;
-import org.apache.abdera.g14n.lang.Lang;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.iri.IRISyntaxException;
+import org.apache.abdera.i18n.lang.InvalidLangTagSyntax;
+import org.apache.abdera.i18n.lang.Lang;
 
 public abstract class ElementWrapper 
   implements Element {

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Entry.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Entry.java?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Entry.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Entry.java Wed Mar 21 20:00:19 2007
@@ -24,8 +24,8 @@
 import javax.activation.MimeType;
 import javax.activation.MimeTypeParseException;
 
-import org.apache.abdera.g14n.iri.IRI;
-import org.apache.abdera.g14n.iri.IRISyntaxException;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.iri.IRISyntaxException;
 
 /**
  * <p>Represents an Atom Entry element.</p>

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Feed.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Feed.java?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Feed.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Feed.java Wed Mar 21 20:00:19 2007
@@ -20,7 +20,7 @@
 import java.util.Comparator;
 import java.util.List;
 
-import org.apache.abdera.g14n.iri.IRISyntaxException;
+import org.apache.abdera.i18n.iri.IRISyntaxException;
 
 /**
  * <p>Represents an Atom Feed Element</p>

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Generator.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Generator.java?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Generator.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Generator.java Wed Mar 21 20:00:19 2007
@@ -17,8 +17,8 @@
 */
 package org.apache.abdera.model;
 
-import org.apache.abdera.g14n.iri.IRI;
-import org.apache.abdera.g14n.iri.IRISyntaxException;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.iri.IRISyntaxException;
 
 
 /**

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/IRIElement.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/IRIElement.java?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/IRIElement.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/IRIElement.java Wed Mar 21 20:00:19 2007
@@ -17,8 +17,8 @@
 */
 package org.apache.abdera.model;
 
-import org.apache.abdera.g14n.iri.IRI;
-import org.apache.abdera.g14n.iri.IRISyntaxException;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.iri.IRISyntaxException;
 
 /**
  * <p>The IRI interface provides a common base for a set of feed and 

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Link.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Link.java?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Link.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Link.java Wed Mar 21 20:00:19 2007
@@ -20,8 +20,8 @@
 import javax.activation.MimeType;
 import javax.activation.MimeTypeParseException;
 
-import org.apache.abdera.g14n.iri.IRI;
-import org.apache.abdera.g14n.iri.IRISyntaxException;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.iri.IRISyntaxException;
 
 /**
  * <p>Represents an Atom Link element.</p>

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Person.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Person.java?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Person.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Person.java Wed Mar 21 20:00:19 2007
@@ -17,8 +17,8 @@
 */
 package org.apache.abdera.model;
 
-import org.apache.abdera.g14n.iri.IRI;
-import org.apache.abdera.g14n.iri.IRISyntaxException;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.iri.IRISyntaxException;
 
 /**
  * <p>An Atom Person Construct</p>

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Source.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Source.java?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Source.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Source.java Wed Mar 21 20:00:19 2007
@@ -22,8 +22,8 @@
 
 import javax.activation.MimeTypeParseException;
 
-import org.apache.abdera.g14n.iri.IRI;
-import org.apache.abdera.g14n.iri.IRISyntaxException;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.iri.IRISyntaxException;
 
 /**
  * <p>Per RFC4287:</p>

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Workspace.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Workspace.java?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Workspace.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Workspace.java Wed Mar 21 20:00:19 2007
@@ -19,7 +19,7 @@
 
 import java.util.List;
 
-import org.apache.abdera.g14n.iri.IRISyntaxException;
+import org.apache.abdera.i18n.iri.IRISyntaxException;
 
 /**
  * <p>An Atom Publishing Protocol Introspection Document workspace element.</p>

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/Parser.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/Parser.java?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/Parser.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/Parser.java Wed Mar 21 20:00:19 2007
@@ -22,7 +22,7 @@
 
 import org.apache.abdera.model.Document;
 import org.apache.abdera.model.Element;
-import org.apache.abdera.g14n.iri.IRISyntaxException;
+import org.apache.abdera.i18n.iri.IRISyntaxException;
 
 public interface Parser {
 

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbderaResult.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbderaResult.java?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbderaResult.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbderaResult.java Wed Mar 21 20:00:19 2007
@@ -29,7 +29,7 @@
 import org.apache.abdera.Abdera;
 import org.apache.abdera.model.Document;
 import org.apache.abdera.model.Element;
-import org.apache.abdera.g14n.iri.IRISyntaxException;
+import org.apache.abdera.i18n.iri.IRISyntaxException;
 
 /**
  * Provides a simple (and likely somewhat inefficient) implementation of 

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbstractParser.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbstractParser.java?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbstractParser.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbstractParser.java Wed Mar 21 20:00:19 2007
@@ -27,7 +27,7 @@
 import org.apache.abdera.parser.ParseException;
 import org.apache.abdera.parser.Parser;
 import org.apache.abdera.parser.ParserOptions;
-import org.apache.abdera.g14n.iri.IRISyntaxException;
+import org.apache.abdera.i18n.iri.IRISyntaxException;
 
 /**
  * Abstract base implementation of Abdera Parser.

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/URIHelper.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/URIHelper.java?view=diff&rev=521094&r1=521093&r2=521094
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/URIHelper.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/URIHelper.java Wed Mar 21 20:00:19 2007
@@ -19,8 +19,8 @@
 
 import java.util.regex.Pattern;
 
-import org.apache.abdera.g14n.iri.IRI;
-import org.apache.abdera.g14n.iri.IRISyntaxException;
+import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.iri.IRISyntaxException;
 
 /**
  * Utility methods for working with URI's / IRI's

Added: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/ChainableBitSet.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/ChainableBitSet.java?view=auto&rev=521094
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/ChainableBitSet.java (added)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/ChainableBitSet.java Wed Mar 21 20:00:19 2007
@@ -0,0 +1,119 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.i18n;
+
+import java.util.BitSet;
+
+/**
+ * Extension to java.util.BitSet that allows calls to set to be chained, e.g.
+ * bs.set2(1).set(2).set(3), making it easier to define a complex bit set in 
+ * a single declaration.
+ */
+public class ChainableBitSet 
+  extends BitSet {
+
+  private static final long serialVersionUID = -1105957441212997513L;
+
+  public ChainableBitSet and2(BitSet set) {
+    and(set);
+    return this;
+  }
+  
+  public ChainableBitSet addNot2(BitSet set) {
+    andNot(set);
+    return this;
+  }
+  
+  public ChainableBitSet clear2(int index) {
+    clear(index);
+    return this;
+  }
+  
+  public ChainableBitSet clear2(int... indexes) {
+    for (int i : indexes) clear(i);
+    return this;
+  }
+  
+  public ChainableBitSet clear2(int startIndex, int endIndex) {
+    clear(startIndex, endIndex);
+    return this;
+  }
+  
+  public ChainableBitSet flip2(int index) {
+    flip(index);
+    return this;
+  }
+  
+  public ChainableBitSet flip2(int... indexes) {
+    for (int i : indexes) flip(i);
+    return this;
+  }
+  
+  public ChainableBitSet flip2(int startIndex, int endIndex) {
+    flip(startIndex,endIndex);
+    return this;
+  }
+  
+  public ChainableBitSet or2(BitSet set) {
+    or(set);
+    return this;
+  }
+  
+  public ChainableBitSet xor2(BitSet set) {
+    xor(set);
+    return this;
+  }
+  
+  public ChainableBitSet set2(String s) {
+    char[] chars = s.toCharArray();
+    for (char c : chars) set(c);
+    return this;
+  }
+  
+  public ChainableBitSet set2(BitSet set) {
+    this.or(set);
+    return this;
+  }
+  
+  public ChainableBitSet set2(int ... bits) {
+    for (int n : bits) set(n);
+    return this;
+  }
+  
+  public ChainableBitSet set2(int fromIndex, int toIndex) {
+    super.set(fromIndex, toIndex+1);
+    return this;
+  }
+
+  public ChainableBitSet set2(int bitIndex) {
+    super.set(bitIndex);
+    return this;
+  }
+
+  public ChainableBitSet set2(int bitIndex, boolean value) {
+    super.set(bitIndex, value);
+    return this;
+  }
+  
+  public ChainableBitSet set2(BitSet set, boolean value) {
+    if (value) return set2(set);
+    else this.andNot(set);
+    return this;
+  }
+  
+}

Added: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/ByteArrayCodepointIterator.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/ByteArrayCodepointIterator.java?view=auto&rev=521094
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/ByteArrayCodepointIterator.java (added)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/ByteArrayCodepointIterator.java Wed Mar 21 20:00:19 2007
@@ -0,0 +1,47 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.i18n.io;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+
+import org.apache.abdera.i18n.io.CharArrayCodepointIterator;
+
+/**
+ * Iterate over Unicode codepoints decoded from an array of bytes
+ */
+public class ByteArrayCodepointIterator 
+  extends CharArrayCodepointIterator {
+  
+  public ByteArrayCodepointIterator(byte[] bytes) {
+    this(bytes,Charset.defaultCharset());
+  }
+  
+  public ByteArrayCodepointIterator(byte[] bytes, String charset) {
+    this(bytes,Charset.forName(charset));
+  }
+  
+  public ByteArrayCodepointIterator(byte[] bytes, Charset charset) {
+    CharBuffer cb = charset.decode(ByteBuffer.wrap(bytes));
+    buffer = cb.array();
+    position = cb.position();
+    limit = cb.limit();
+  }
+
+}

Added: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharArrayCodepointIterator.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharArrayCodepointIterator.java?view=auto&rev=521094
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharArrayCodepointIterator.java (added)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharArrayCodepointIterator.java Wed Mar 21 20:00:19 2007
@@ -0,0 +1,52 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.i18n.io;
+
+import org.apache.abdera.i18n.io.CodepointIterator;
+
+/**
+ * Iterate over Unicode codepoints contained in a char array
+ */
+public class CharArrayCodepointIterator 
+  extends CodepointIterator {
+
+  protected char[] buffer;
+  
+  protected CharArrayCodepointIterator() {}
+  
+  public CharArrayCodepointIterator(char[] buffer) {
+    this(buffer,0,buffer.length);
+  }
+  
+  public CharArrayCodepointIterator(char[] buffer, int n, int e) {
+    this.buffer = buffer;
+    this.position = n;
+    this.limit = Math.min(buffer.length-n,e);
+  }
+  
+  protected char get() {
+    return (position < limit) ? buffer[position++] : (char)-1;
+  }
+  
+  protected char get(int index) {
+    if (index < 0 || index >= limit) 
+      throw new ArrayIndexOutOfBoundsException(index);
+    return buffer[index];
+  }
+  
+}

Added: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharBufferCodepointIterator.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharBufferCodepointIterator.java?view=auto&rev=521094
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharBufferCodepointIterator.java (added)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharBufferCodepointIterator.java Wed Mar 21 20:00:19 2007
@@ -0,0 +1,36 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.i18n.io;
+
+import java.nio.CharBuffer;
+
+import org.apache.abdera.i18n.io.CharArrayCodepointIterator;
+
+/**
+ * Iterate over Unicode codepoints in a java.nio.CharBuffer
+ */
+public class CharBufferCodepointIterator 
+  extends CharArrayCodepointIterator {
+
+  public CharBufferCodepointIterator(CharBuffer cb) {
+    buffer = cb.array();
+    position = cb.position();
+    limit = cb.limit();
+  }
+  
+}

Added: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharSequenceCodepointIterator.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharSequenceCodepointIterator.java?view=auto&rev=521094
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharSequenceCodepointIterator.java (added)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharSequenceCodepointIterator.java Wed Mar 21 20:00:19 2007
@@ -0,0 +1,48 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.i18n.io;
+
+import org.apache.abdera.i18n.io.CodepointIterator;
+
+/**
+ * Iterate over Unicode codepoints in a CharSequence (e.g. String, StringBuffer, etc)
+ */
+public class CharSequenceCodepointIterator 
+  extends CodepointIterator {
+
+  private CharSequence buffer;
+  
+  public CharSequenceCodepointIterator(CharSequence buffer) {
+    this(buffer,0,buffer.length());
+  }
+  
+  public CharSequenceCodepointIterator(CharSequence buffer, int n, int e) {
+    this.buffer = buffer;
+    this.position = n;
+    this.limit = Math.min(buffer.length()-n,e);
+  }
+  
+  protected char get() {
+    return buffer.charAt(position++);
+  }
+
+  protected char get(int index) {
+    return buffer.charAt(index);
+  }
+  
+}

Added: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharUtils.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharUtils.java?view=auto&rev=521094
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharUtils.java (added)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CharUtils.java Wed Mar 21 20:00:19 2007
@@ -0,0 +1,330 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.i18n.io;
+
+import java.util.BitSet;
+
+import org.apache.abdera.i18n.io.CodepointIterator;
+import org.apache.abdera.i18n.io.InvalidCharacterException;
+import org.apache.abdera.i18n.io.RestrictedCodepointIterator;
+
+/**
+ * General utilities for dealing with Unicode characters
+ */
+public final class CharUtils {
+
+  private CharUtils() {}
+ 
+  public static boolean isValidCodepoint(int d) {
+    return d >= 0x000000 && d <= 0x10ffff;
+  }
+  
+  public static int scanNot(CodepointIterator ci, BitSet set) throws InvalidCharacterException {
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,true,true);
+    while (rci.hasNext()) rci.next();
+    return rci.position;
+  }
+  
+  public static int scanNot(char[] array, BitSet set) throws InvalidCharacterException {
+    CodepointIterator ci = CodepointIterator.forCharArray(array);
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,true,true);
+    while (rci.hasNext()) rci.next();
+    return rci.position;
+  }
+  
+  public static int scan(CodepointIterator ci, BitSet set) throws InvalidCharacterException {
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,true);
+    while (rci.hasNext()) rci.next();
+    return rci.position();
+  }
+  
+  public static int scan(char[] array, BitSet set) throws InvalidCharacterException {
+    CodepointIterator ci = CodepointIterator.forCharArray(array);
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,true);
+    while (rci.hasNext()) rci.next();
+    return rci.position();
+  }
+  
+  public static int scan(String s, BitSet set) throws InvalidCharacterException {
+    CodepointIterator ci = CodepointIterator.forCharSequence(s);
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,true);
+    while (rci.hasNext()) rci.next();
+    return rci.position;
+  }
+  
+  public static void verifyNot(CodepointIterator ci, BitSet set) throws InvalidCharacterException {
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,false,true);
+    while (rci.hasNext()) rci.next();
+  }
+  
+  public static void verifyNot(char[] array, BitSet set) throws InvalidCharacterException {
+    CodepointIterator ci = CodepointIterator.forCharArray(array);
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,false,true);
+    while (rci.hasNext()) rci.next();
+  }
+  
+  public static void verify(CodepointIterator ci, BitSet set) throws InvalidCharacterException {
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,false);
+    while (rci.hasNext()) rci.next();
+  }
+  
+  public static void verify(char[] array, BitSet set) throws InvalidCharacterException {
+    CodepointIterator ci = CodepointIterator.forCharArray(array);
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,false);
+    while (rci.hasNext()) rci.next();
+  }
+  
+  public static void verify(String s, BitSet set) throws InvalidCharacterException {
+    if (s == null) return;
+    CodepointIterator ci = CodepointIterator.forCharSequence(s);
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,false);
+    while (rci.hasNext()) rci.next();
+  }
+  
+  public static boolean inRange(char[] chars, char low, char high) {
+    for (int i = 0; i < chars.length; i++)
+      if (chars[i] < low || chars[i] > high) return false;
+    return true;
+  }
+
+  public static boolean inRange(char[] chars, int low, int high) {
+    for (int i = 0; i < chars.length; i++) {
+      char n = chars[i];
+      int c = (isHighSurrogate(n) && 
+               i + 1 < chars.length && 
+               isLowSurrogate(chars[i+1])) ? toCodePoint(n,chars[i++]) : n;
+      if (c < low || c > high) return false;
+    }
+    return true;
+  }
+  
+  public static boolean isSet(int n, BitSet... sets) {
+    if (n == -1) return false;
+    BitSet set = new BitSet();
+    for (BitSet s : sets) set.or(s);
+    return set.get(n);
+  }
+  
+  public static void append(StringBuffer buf, int c) {
+    if (isSupplementary(c)) {
+      buf.append(getHighSurrogate(c));
+      buf.append(getLowSurrogate(c));
+    } else buf.append((char)c);
+  }
+  
+  public static char getHighSurrogate(int c) {
+    return (c >= 0x10000) ?
+       (char)((0xD800 - (0x10000 >> 10)) + (c >> 10)) : 0;
+  }
+
+  public static char getLowSurrogate(int c) {    
+    return (c >= 0x10000) ?
+        (char)(0xDC00 + (c & 0x3FF)) : (char)c;
+  }
+  
+  public static boolean isHighSurrogate(char c) {
+    return c <= '\uDBFF' && c >= '\uD800';
+  }
+
+  public static boolean isLowSurrogate(char c) {
+    return c <= '\uDFFF' && c >= '\uDC00';
+  }
+  
+  public static boolean isSupplementary(int c) {
+    return c <= 0x10ffff && c >= 0x010000;
+  }
+  
+  public static boolean isSurrogatePair(char high, char low) {
+    return isHighSurrogate(high) && isLowSurrogate(low);
+  }
+  
+  public static int toCodePoint(char[] chars) {
+    return toCodePoint(chars[0],chars[1]);
+  }
+  
+  public static int toCodePoint(char high, char low) {
+    return ((high - '\uD800') << 10) + (low - '\uDC00') + 0x010000;    
+  }
+
+  public static int charAt(String s, int i) {
+    char c = s.charAt(i);
+    if (c < 0xD800 || c > 0xDFFF) return c;
+    if (isHighSurrogate(c)) {
+      if (s.length() != i) {
+        char low = s.charAt(i+1);
+        if (isLowSurrogate(low)) return toCodePoint(c,low);
+      }
+    } else if (isLowSurrogate(c)) {
+      if (i >= 1) {
+        char high = s.charAt(i-1);
+        if (isHighSurrogate(high)) return toCodePoint(high,c);
+      }
+    }
+    return c;
+  }
+  
+  public static int charAt(StringBuffer s, int i) {
+    char c = s.charAt(i);
+    if (c < 0xD800 || c > 0xDFFF) return c;
+    if (isHighSurrogate(c)) {
+      if (s.length() != i) {
+        char low = s.charAt(i+1);
+        if (isLowSurrogate(low)) return toCodePoint(c,low);
+      }
+    } else if (isLowSurrogate(c)) {
+      if (i >= 1) {
+        char high = s.charAt(i-1);
+        if (isHighSurrogate(high)) return toCodePoint(high,c);
+      }
+    }
+    return c;
+  }
+  
+  public static void insert(StringBuffer s, int i, int c) {
+    if (i > 0 && i < s.length()) {
+      char ch = s.charAt(i);
+      boolean low = isLowSurrogate(ch);
+      if (low) {
+        if (low && isHighSurrogate(s.charAt(i-1))) {
+          i--;
+        }
+      }
+    }
+    s.insert(i, toString(c));
+  }
+  
+  public static void setChar(StringBuffer s, int i, int c) {
+    int l = 1;
+    char ch = s.charAt(i);
+    boolean high = isHighSurrogate(ch);
+    boolean low = isLowSurrogate(ch);
+    if (high || low) {
+      if (high && (i+1) < s.length() && isLowSurrogate(s.charAt(i+1))) l++;
+      else {
+        if (low && i > 0 && isHighSurrogate(s.charAt(i-1))) {
+          i--; l++;
+        }
+      }
+    }
+    s.replace(i, i+l, toString(c));
+  }
+  
+  public static int size(int c) {
+    return (isSupplementary(c)) ? 2 : 1;
+  }
+  
+  private static String supplementaryToString(int c) {
+    StringBuffer buf = new StringBuffer();
+    buf.append((char)getHighSurrogate(c));
+    buf.append((char)getLowSurrogate(c));
+    return buf.toString();
+  }
+  
+  public static String toString(int c) {
+    return (isSupplementary(c)) ? 
+      supplementaryToString(c) : 
+      String.valueOf((char)c);
+  }
+  
+  
+
+  private static final char LRE = 0x202A; 
+  private static final char RLE = 0x202B; 
+  private static final char LRO = 0x202D; 
+  private static final char RLO = 0x202E; 
+  private static final char LRM = 0x200E; 
+  private static final char RLM = 0x200F;
+  private static final char PDF = 0x202C;
+  
+  /**
+   * Removes leading and trailing bidi controls from the string
+   */
+  public static String stripBidi(String s) {
+    if (s == null || s.length() <= 1) return s;
+    if (charIsBidiControl(s.charAt(0)))
+      s = s.substring(1);
+    if (charIsBidiControl(s.charAt(s.length()-1)))
+      s = s.substring(0,s.length()-1);
+    return s;
+  }
+  
+  /**
+   * Returns true if the character is a bidi control 
+   */
+  public static boolean charIsBidiControl(char c) {
+    return c == 0x202A ||
+    c == LRE ||
+    c == RLE ||
+    c == LRO ||
+    c == RLO ||
+    c == RLM ||
+    c == LRM || 
+    c == PDF;
+  }
+  
+  private static String wrap(String s, char c1, char c2) {
+    StringBuffer buf = new StringBuffer(s);
+    if (buf.length() > 1) {
+      if (buf.charAt(0) != c1) buf.insert(0, c1);
+      if (buf.charAt(buf.length()-1) != c2) buf.append(c2);
+    }
+    return buf.toString();
+  }
+  
+  /**
+   * Wrap the string with Bidi Right-to-Left embed
+   */
+  public static String bidiRLE(String s) {
+    return wrap(s,RLE,PDF);
+  }
+  
+  /**
+   * Wrap the string with Bidi Right-to-Left override 
+   */
+  public static String bidiRLO(String s) {
+    return wrap(s,RLO,PDF);
+  }
+  
+  /**
+   * Wrap the string with Bidi Left-to-Right embed
+   */
+  public static String bidiLRE(String s) {
+    return wrap(s,LRE,PDF);
+  }
+  
+  /**
+   * Wrap the string with Bidi Left-to-Right override
+   */
+  public static String bidiLRO(String s) {
+    return wrap(s,LRO,PDF);
+  }
+  
+  /**
+   * Wrap the string with Bidi RML marks
+   */
+  public static String bidiRLM(String s) {
+    return wrap(s,RLM,RLM);
+  }
+  
+  /**
+   * Wrap the string with Bidi LRM marks
+   */
+  public static String bidiLRM(String s) {
+    return wrap(s,LRM,LRM);
+  }
+}

Added: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CodepointIterator.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CodepointIterator.java?view=auto&rev=521094
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CodepointIterator.java (added)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/CodepointIterator.java Wed Mar 21 20:00:19 2007
@@ -0,0 +1,175 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.i18n.io;
+
+import java.nio.CharBuffer;
+
+import org.apache.abdera.i18n.io.ByteArrayCodepointIterator;
+import org.apache.abdera.i18n.io.CharArrayCodepointIterator;
+import org.apache.abdera.i18n.io.CharBufferCodepointIterator;
+import org.apache.abdera.i18n.io.CharSequenceCodepointIterator;
+import org.apache.abdera.i18n.io.CharUtils;
+import org.apache.abdera.i18n.io.CodepointIterator;
+import org.apache.abdera.i18n.io.InvalidCharacterException;
+
+/**
+ * Iterate over Unicode codepoints 
+ */
+public abstract class CodepointIterator {
+
+  public static CodepointIterator forCharArray(char[] array) {
+    return new CharArrayCodepointIterator(array);
+  }
+  
+  public static CodepointIterator forCharSequence(CharSequence seq) {
+    return new CharSequenceCodepointIterator(seq);
+  }
+  
+  public static CodepointIterator forByteArray(byte[] array) {
+    return new ByteArrayCodepointIterator(array);
+  }
+  
+  public static CodepointIterator forCharBuffer(CharBuffer buffer) {
+    return new CharBufferCodepointIterator(buffer);
+  }
+  
+  protected int position = -1;
+  protected int limit = -1;
+  
+  protected abstract char get();
+  
+  protected abstract char get(int index);
+  
+  public boolean hasNext() {
+    return remaining() > 0;
+  }
+
+  public int last() {
+    return (position() > 0) ? get(position() - 1) : -1;
+  }
+  
+  public int lastPosition() {
+    int p = position();
+    return (p > -1) ? 
+      (p >= limit()) ? p : p - 1 : -1;
+  }
+  
+  public char[] nextChars() throws InvalidCharacterException {
+    if (hasNext()) {
+      if (isNextSurrogate()) {
+        char c1 = get();
+        if (CharUtils.isHighSurrogate(c1) && position() < limit()) {
+          char c2 = get();
+          if (CharUtils.isLowSurrogate(c2)) {
+            return new char[] {c1,c2};
+          } else {
+            throw new InvalidCharacterException(c2);
+          }
+        } else if (CharUtils.isLowSurrogate(c1) && position() > 0) {
+          char c2 = get(position()-2);
+          if (CharUtils.isHighSurrogate(c2)) {
+            return new char[] {c1,c2};
+          } else {
+            throw new InvalidCharacterException(c2);
+          }
+        }
+      }
+      return new char[] {get()}; 
+    } 
+    return null;
+  }
+  
+  public char[] peekChars() throws InvalidCharacterException {
+    return peekChars(position());
+  }
+  
+  private char[] peekChars(int pos) throws InvalidCharacterException {
+    if (pos < 0 || pos >= limit()) return null;
+    char c1 = get(pos);
+    if (CharUtils.isHighSurrogate(c1) && pos < limit()) {
+      char c2 = get(pos+1);
+      if (CharUtils.isLowSurrogate(c2)) {
+        return new char[] {c1,c2};
+      } else {
+        throw new InvalidCharacterException(c2);
+      }
+    } else if (CharUtils.isLowSurrogate(c1) && pos > 1) {
+      char c2 = get(pos-1);
+      if (CharUtils.isHighSurrogate(c2)) {
+        return new char[] {c2,c1};
+      } else {
+        throw new InvalidCharacterException(c2);
+      }
+    } else  return new char[] {c1}; 
+  }
+  
+  public int next() throws InvalidCharacterException {
+    char[] chars = nextChars();
+    return (chars == null) ? -1 :
+      (chars.length == 1) ? chars[0] :
+      CharUtils.toCodePoint(chars[0], chars[1]);
+  }
+
+  public int peek() throws InvalidCharacterException {
+    char[] chars = peekChars();
+    return (chars == null) ? -1 :
+      (chars.length == 1) ? chars[0] :
+      CharUtils.toCodePoint(chars[0], chars[1]);
+  }
+  
+  public int peek(int index) throws InvalidCharacterException {
+    char[] chars = peekChars(index);
+    return (chars == null) ? -1 :
+      (chars.length == 1) ? chars[0] :
+      CharUtils.toCodePoint(chars[0], chars[1]);
+  }
+  
+  public void position(int n) {
+    if (n < 0 || n > limit()) throw new ArrayIndexOutOfBoundsException(n);
+    position = n;
+  }
+  
+  public int position() {
+    return position;
+  }
+
+  public int limit() {
+    return limit;
+  }
+  
+  public int remaining() {
+    return limit - position();
+  }
+  
+  private boolean isNextSurrogate() {
+    if (!hasNext()) return false;
+    char c = get(position());
+    return CharUtils.isHighSurrogate(c) || CharUtils.isLowSurrogate(c);
+  }
+
+  public boolean isHigh(int index) {
+    if (index < 0 || index > limit()) throw new ArrayIndexOutOfBoundsException(index);
+    return CharUtils.isHighSurrogate(get(index));
+  }
+
+  public boolean isLow(int index) {
+    if (index < 0 || index > limit()) throw new ArrayIndexOutOfBoundsException(index);
+    return CharUtils.isLowSurrogate(get(index));
+  }
+  
+}

Added: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/DynamicPushbackInputStream.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/DynamicPushbackInputStream.java?view=auto&rev=521094
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/DynamicPushbackInputStream.java (added)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/DynamicPushbackInputStream.java Wed Mar 21 20:00:19 2007
@@ -0,0 +1,112 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.i18n.io;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PushbackInputStream;
+
+/**
+ * PushbackInputStream implementation that performs dynamic resizing of
+ * the unread buffer
+ */
+public class DynamicPushbackInputStream extends PushbackInputStream {
+
+  private int origsize = 1;
+  
+  public DynamicPushbackInputStream(InputStream in) {
+    super(in);
+  }
+
+  public DynamicPushbackInputStream(InputStream in, int initialSize) {
+    super(in,initialSize);
+    this.origsize = initialSize;
+  }
+
+  public synchronized int clear() {
+    int m = buf.length;
+    buf = new byte[origsize];
+    pos = origsize;
+    return m;
+  }
+  
+  public synchronized int shrink() {
+    byte[] old = buf;
+    if (pos == 0) return 0; // nothing to do
+    int n = old.length - pos;
+    int m, p,s,l;
+    if (n < origsize) {
+      buf = new byte[origsize];
+      p = pos;
+      s = origsize - n;
+      l = old.length-p;
+      m = old.length - origsize;
+      pos = s;
+    } else {
+      buf = new byte[n];
+      p = pos;
+      s = 0;
+      l = n;
+      m = old.length - l;
+      pos = 0;
+    }
+    System.arraycopy(old, p, buf, s, l);
+    return m;
+  }
+  
+  private void resize(int len) {
+    byte[] old = buf;
+    buf = new byte[old.length + len];
+    System.arraycopy(old, 0, buf, len, old.length);
+  }
+
+  public synchronized void unread(byte[] b, int off, int len) throws IOException {
+    if (len > pos && pos + len > buf.length) {
+      resize(len-pos);
+      pos += len-pos;
+    }
+    super.unread(b, off, len);
+  }
+
+  public synchronized void unread(int b) throws IOException {
+    if (pos == 0) {
+      resize(1);
+      pos++;
+    }
+    super.unread(b);
+  }
+  
+  public synchronized int read() throws IOException {
+    int m = super.read();
+    if (pos >= buf.length && buf.length > origsize) shrink();
+    return m;
+  }
+
+  public synchronized int read(byte[] b, int off, int len) throws IOException {
+    this.available(); // workaround for a problem in PushbackInputStream, without this, the amount of bytes read from some streams will be incorrect
+    int r = super.read(b, off, len);
+    if (pos >= buf.length && buf.length > origsize) shrink();
+    return r;
+  }
+
+  public synchronized long skip(long n) throws IOException {
+    long r = super.skip(n);
+    if (pos >= buf.length && buf.length > origsize) shrink();
+    return r;
+  }
+}

Added: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/FilterCodepointIterator.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/FilterCodepointIterator.java?view=auto&rev=521094
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/FilterCodepointIterator.java (added)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/FilterCodepointIterator.java Wed Mar 21 20:00:19 2007
@@ -0,0 +1,106 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.i18n.io;
+
+import org.apache.abdera.i18n.io.CodepointIterator;
+import org.apache.abdera.i18n.io.InvalidCharacterException;
+
+/**
+ * Base implementation of a CodepointIterator that filters the output of
+ * another CodpointIterator
+ */
+public abstract class FilterCodepointIterator 
+  extends CodepointIterator {
+
+  private CodepointIterator internal;
+  
+  protected FilterCodepointIterator(CodepointIterator internal) {
+    this.internal = internal;
+  }
+  
+  @Override
+  protected char get() {
+    return internal.get();
+  }
+
+  @Override
+  protected char get(int index) {
+    return internal.get(index);
+  }
+
+  @Override
+  public boolean hasNext() {
+    return internal.hasNext();
+  }
+
+  @Override
+  public boolean isHigh(int index) {
+    return internal.isHigh(index);
+  }
+
+  @Override
+  public boolean isLow(int index) {
+    return internal.isLow(index);
+  }
+
+  @Override
+  public int limit() {
+    return internal.limit();
+  }
+
+  @Override
+  public int next() throws InvalidCharacterException {
+    return internal.next();
+  }
+
+  @Override
+  public char[] nextChars() throws InvalidCharacterException {
+    return internal.nextChars();
+  }
+
+  @Override
+  public int peek() throws InvalidCharacterException {
+    return internal.peek();
+  }
+
+  @Override
+  public int peek(int index) throws InvalidCharacterException {
+    return internal.peek(index);
+  }
+
+  @Override
+  public char[] peekChars() throws InvalidCharacterException {
+    return internal.peekChars();
+  }
+
+  @Override
+  public int position() {
+    return internal.position();
+  }
+
+  @Override
+  public int remaining() {
+    return internal.remaining();
+  }
+  
+  @Override
+  public void position(int position) {
+    internal.position(position);
+  }
+
+}

Added: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/InvalidCharacterException.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/InvalidCharacterException.java?view=auto&rev=521094
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/InvalidCharacterException.java (added)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/InvalidCharacterException.java Wed Mar 21 20:00:19 2007
@@ -0,0 +1,38 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.i18n.io;
+
+import java.io.IOException;
+
+public class InvalidCharacterException 
+  extends IOException {
+
+  private static final long serialVersionUID = -7150645484748059676L;
+  private int input;
+  
+  public InvalidCharacterException(int input) {
+    this.input = input;
+  }
+
+  @Override
+  public String getMessage() {
+    return "Invalid Character 0x" + Integer.toHexString(input);
+  }
+
+  
+}

Added: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/PeekAheadInputStream.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/PeekAheadInputStream.java?view=auto&rev=521094
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/PeekAheadInputStream.java (added)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/PeekAheadInputStream.java Wed Mar 21 20:00:19 2007
@@ -0,0 +1,56 @@
+package org.apache.abdera.i18n.io;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.abdera.i18n.io.RewindableInputStream;
+
+/**
+ * A version of RewindableInputStream that provides methods for peeking ahead 
+ * in the stream (equivalent to read() followed by an appropriate unread() 
+ */
+public class PeekAheadInputStream 
+  extends RewindableInputStream {
+  
+  public PeekAheadInputStream(InputStream in) {
+    super(in);
+  }
+  
+  public PeekAheadInputStream(InputStream in, int initialSize) {
+    super(in,initialSize);
+  }
+
+  public synchronized int peek() throws IOException {
+    int m = read();
+    unread(m);
+    return m;
+  }
+  
+  public synchronized int peek(byte[] buf) throws IOException {
+    return peek(buf, 0, buf.length);
+  }
+  
+  public synchronized int peek(byte[] buf, int off, int len) throws IOException {
+    int r = read(buf, off, len);
+    unread(buf,off,len);
+    return r;
+  }
+
+}

Added: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/ReadWriteByteChannel.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/ReadWriteByteChannel.java?view=auto&rev=521094
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/ReadWriteByteChannel.java (added)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/ReadWriteByteChannel.java Wed Mar 21 20:00:19 2007
@@ -0,0 +1,207 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.i18n.io;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.WritableByteChannel;
+
+import org.apache.abdera.i18n.io.ByteArrayCodepointIterator;
+import org.apache.abdera.i18n.io.CodepointIterator;
+
+/**
+ * Implements a buffer that provides a slightly more efficient way of writing,
+ * and then reading a stream of bytes.  
+ * 
+ * To use:
+ * 
+ *   ReadWriteByteChannel rw = new ReadWriteByteChannel();
+ *   OutputStream out = rw.getOutputStream();
+ *   out.write(bytes);
+ *   out.close();
+ * 
+ *   InputStream in = rw.getInputStream();
+ *   int i = -1;
+ *   while ((i = in.read()) != -1) {...}
+ * 
+ * By default, closing the OutputStream will automatically cause it to
+ * flip over to Read mode, locking the buffer from further writes and 
+ * setting the read position to 0.
+ * 
+ * Once the Buffer has been fully read, it must be reset, which sets it 
+ * back into write mode and moves the position pointer back to 0;
+ * 
+ */
+public class ReadWriteByteChannel 
+  implements ReadableByteChannel,
+             WritableByteChannel,
+             Cloneable, 
+             Serializable {
+
+  private static final long serialVersionUID = 5984202999779004084L;
+  private static final int INITIAL_CAPACITY = 32;
+  protected int position = 0;
+  protected int scale = INITIAL_CAPACITY;
+  protected boolean closed = false;
+  protected byte[] buffer = null;
+  protected boolean flipped = false;
+  protected boolean flipOnClose = true;
+  
+  public ReadWriteByteChannel() {
+    this(INITIAL_CAPACITY);
+  }
+  
+  public ReadWriteByteChannel(int capacity) {
+    this(capacity, true);
+  }
+  
+  public ReadWriteByteChannel(int capacity, boolean flipOnClose) {
+    grow(capacity);
+    this.scale = capacity;
+    this.flipOnClose = flipOnClose;
+  }
+  
+  public Object clone() throws CloneNotSupportedException {
+    return super.clone();
+  }
+  
+  public InputStream getInputStream() {
+    if (!flipped) notflipped();
+    return Channels.newInputStream(this);
+  }
+  
+  public OutputStream getOutputStream() {
+    if (flipped) alreadyflipped();
+    return Channels.newOutputStream(this);
+  }
+  
+  public Writer getWriter(String charset) {
+    if (flipped) alreadyflipped();
+    return Channels.newWriter(this, charset);
+  }
+  
+  public Reader getReader(String charset) {
+    if (!flipped) notflipped();
+    return Channels.newReader(this, charset);
+  }
+  
+  public byte[] getBuffer() {
+    if (!flipped) notflipped(); 
+    return buffer;
+  }
+  
+  public CodepointIterator getIterator() {
+    if (!flipped) notflipped();
+    return new ByteArrayCodepointIterator(buffer);
+  }
+  
+  public CodepointIterator getIterator(String charset) {
+    if (!flipped) notflipped();
+    return new ByteArrayCodepointIterator(buffer,charset);
+  }
+  
+  private void grow(int capacity)  {
+    if (buffer == null) {
+      buffer = new byte[capacity];
+      return;
+    } else {
+      byte[] buf =  new byte[buffer.length + capacity];
+      System.arraycopy(buffer, 0, buf, 0, buffer.length);
+      buffer = buf;
+    }
+  }
+
+  private void compact() {
+    if (buffer != null) {
+      byte[] buf = new byte[position];
+      System.arraycopy(buffer,0,buf,0,position);
+      buffer = buf;
+    }
+  }
+  
+  public synchronized int read(ByteBuffer dst) throws IOException {
+    if (!flipped) notflipped();
+    if (dst.hasRemaining() && position < buffer.length) {
+      int r = Math.min(dst.remaining(), buffer.length - position);
+      dst.put(buffer, position, r);
+      dst.flip();
+      position += r;
+      return r;
+    }
+    return -1;
+  }
+
+  public synchronized void flip() {
+    if (flipped) alreadyflipped();
+    compact();
+    position = 0;
+    flipped = true;
+  }
+  
+  public synchronized void rewind() {
+    position = 0;
+  }
+  
+  public synchronized void reset() {
+    position = 0;
+    compact();   // clear the buffer
+    grow(scale); // grow the buffer
+    flipped = false;
+  }
+  
+  public void close() throws IOException {
+    if (flipOnClose && !flipped) flip();
+  }
+  
+  public boolean isOpen() {
+    return true;
+  }
+
+  public synchronized int write(ByteBuffer src) throws IOException {
+    if (flipped) alreadyflipped();
+    if (src.hasRemaining()) {
+      int r = Math.min(src.remaining(), buffer.length - position);
+      src.get(buffer, position, r);
+      position += r;
+      return r;
+    }
+    return -1;
+  }
+
+  private void alreadyflipped() {
+    throw new IllegalStateException("The buffer has already been flipped");
+  }
+  
+  private void notflipped() {
+    throw new IllegalStateException("The buffer has not yet been flipped");
+  }
+  
+  public void transferTo(WritableByteChannel channel) throws IOException {
+    if (!flipped) notflipped();
+    ByteBuffer buf = ByteBuffer.wrap(buffer);
+    while(buf.hasRemaining()) channel.write(buf);
+    buf.clear();
+  }
+}

Added: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/RestrictedCodepointIterator.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/RestrictedCodepointIterator.java?view=auto&rev=521094
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/RestrictedCodepointIterator.java (added)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/io/RestrictedCodepointIterator.java Wed Mar 21 20:00:19 2007
@@ -0,0 +1,128 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.i18n.io;
+
+import java.util.BitSet;
+
+import org.apache.abdera.i18n.ChainableBitSet;
+import org.apache.abdera.i18n.io.CharUtils;
+import org.apache.abdera.i18n.io.CodepointIterator;
+import org.apache.abdera.i18n.io.FilterCodepointIterator;
+import org.apache.abdera.i18n.io.InvalidCharacterException;
+import org.apache.abdera.i18n.io.RestrictedCodepointIterator;
+
+
+/**
+ * A CodepointIterator implementation that checks output against a BitSet.
+ * If the iterator is set to "scanning only", the iterator will return -1
+ * upon encountering a codepoint not in the set, otherwise the iterator 
+ * will throw an InvalidCharacterException
+ */
+public class RestrictedCodepointIterator 
+  extends FilterCodepointIterator {
+
+  private BitSet bitset;
+  private boolean scanningOnly = false;
+  private boolean notset = false;
+
+  protected RestrictedCodepointIterator(
+    CodepointIterator internal, 
+    BitSet bitset) {
+      this(internal,bitset,false);
+  }
+
+  protected RestrictedCodepointIterator(
+    CodepointIterator internal, 
+    BitSet bitset,
+    boolean scanningOnly) {
+      this(internal, bitset, scanningOnly, false);
+  }
+  
+  protected RestrictedCodepointIterator(
+      CodepointIterator internal, 
+      BitSet bitset,
+      boolean scanningOnly,
+      boolean notset) {
+      super(internal);
+      this.bitset = bitset;
+      this.scanningOnly = scanningOnly;
+      this.notset = notset;
+    }
+
+  public boolean hasNext() {
+    boolean b = super.hasNext();
+    if (scanningOnly) {
+      try {
+        int cp = peek(position());
+        if (b && cp != -1 && check(cp)) return false;
+      } catch (InvalidCharacterException e) { return false; }
+    } 
+    return b;
+  }
+  
+  @Override
+  public int next() throws InvalidCharacterException {
+    int cp = super.next();
+    if (cp != -1 && check(cp)) {
+      if (scanningOnly) {
+        position(position()-1);
+        return -1;
+      }
+      else throw new InvalidCharacterException(cp);
+    }
+    return cp;
+  }
+
+  private boolean check(int cp) {
+    return (!notset) ? !bitset.get(cp) : bitset.get(cp);
+  }
+  
+  @Override
+  public char[] nextChars() throws InvalidCharacterException {
+    char[] chars = super.nextChars();
+    if (chars != null && chars.length > 0) {
+      if (chars.length == 1 && check(chars[0])) {
+        if (scanningOnly) {
+          position(position()-1);
+          return null;
+        }
+        else throw new InvalidCharacterException(chars[0]);
+      } else if (chars.length == 2) {
+        int cp = CharUtils.toCodePoint(chars);
+        if (check(cp)) {
+          if (scanningOnly) {
+            position(position()-2);
+            return null; 
+          }
+          else throw new InvalidCharacterException(cp);
+        }
+      }
+    }
+    return chars;
+  }
+ 
+  public static void main(String... args) throws Exception {
+    
+    ChainableBitSet set = new ChainableBitSet().set2('a','b','c');
+    char[] c = {'a','b','c',CharUtils.getHighSurrogate(0x10000),CharUtils.getLowSurrogate(0x10000)};
+    
+    CodepointIterator ci = CodepointIterator.forCharArray(c);
+    RestrictedCodepointIterator rci = new RestrictedCodepointIterator(ci,set,false,true);
+    while(rci.hasNext()) System.out.println(rci.next());
+  }
+}



Mime
View raw message