JAL-1807
[jalview.git] / site / j2s / JU / ListDataReader.js
diff --git a/site/j2s/JU/ListDataReader.js b/site/j2s/JU/ListDataReader.js
new file mode 100644 (file)
index 0000000..4a6988c
--- /dev/null
@@ -0,0 +1,31 @@
+Clazz.declarePackage ("JU");
+Clazz.load (["JU.DataReader"], "JU.ListDataReader", null, function () {
+c$ = Clazz.decorateAsClass (function () {
+this.data = null;
+this.pt = 0;
+this.len = 0;
+Clazz.instantialize (this, arguments);
+}, JU, "ListDataReader", JU.DataReader);
+Clazz.overrideMethod (c$, "setData", 
+function (data) {
+this.data = data;
+this.len = this.data.size ();
+return this;
+}, "~O");
+Clazz.overrideMethod (c$, "read", 
+function (buf, off, len) {
+return this.readBuf (buf, off, len);
+}, "~A,~N,~N");
+Clazz.overrideMethod (c$, "readLine", 
+function () {
+return (this.pt < this.len ? this.data.get (this.pt++) : null);
+});
+Clazz.defineMethod (c$, "mark", 
+function (ptr) {
+this.ptMark = this.pt;
+}, "~N");
+Clazz.overrideMethod (c$, "reset", 
+function () {
+this.pt = this.ptMark;
+});
+});