defineClass(org.helma.wrappers.ByteArray);
export('ByteArray');

__shared__ = true;

Object.defineProperty(String.prototype, 'toByteArray', {
    value: function(charset) {
        charset = charset || 'utf8';
        return new ByteArray(String(this), charset);
    }
});

Object.defineProperty(ByteArray.prototype, 'reverse', {
    value: function() {
        return Array.reverse(this);
    }
})

Object.defineProperty(ByteArray.prototype, 'sort', {
    value: function(fn) {
        fn = fn || function(a, b) a - b;
        return Array.sort(this, fn);
    }
})

Object.defineProperty(ByteArray.prototype, 'forEach', {
    value: function(fn, thisObj) {
        Array.forEach(this, fn, thisObj);
    }
})


@@ -383,32 +383,33 @@
 (this);%0A    %7D%0A%7D)
+;
 %0A%0AObject.defineP
@@ -559,16 +559,17 @@
     %7D%0A%7D)
+;
 %0A%0AObject
@@ -703,10 +703,1094 @@
     %7D%0A%7D)
+;
 %0A%0A
+Object.defineProperty(ByteArray.prototype, 'filter', %7B%0A    value: function(fn, thisObj) %7B%0A        return Array.filter(this, fn, thisObj);%0A    %7D%0A%7D);%0A%0AObject.defineProperty(ByteArray.prototype, 'some', %7B%0A    value: function(fn, thisObj) %7B%0A        return Array.some(this, fn, thisObj);%0A    %7D%0A%7D);%0A%0AObject.defineProperty(ByteArray.prototype, 'every', %7B%0A    value: function(fn, thisObj) %7B%0A        return Array.every(this, fn, thisObj);%0A    %7D%0A%7D);%0A%0AObject.defineProperty(ByteArray.prototype, 'map', %7B%0A    value: function(fn, thisObj) %7B%0A        return Array.map(this, fn, thisObj);%0A    %7D%0A%7D);%0A%0AObject.defineProperty(ByteArray.prototype, 'reduce', %7B%0A    value: function(fn, initialValue) %7B%0A        return initialValue === undefined ?%0A               Array.reduce(this, fn) :%0A               Array.reduce(this, fn, initialValue);%0A    %7D%0A%7D);%0A%0AObject.defineProperty(ByteArray.prototype, 'reduceRight', %7B%0A    value: function(fn, initialValue) %7B%0A        return initialValue === undefined ?%0A               Array.reduceRight(this, fn) :%0A               Array.reduceRight(this, fn, initialValue);%0A    %7D%0A%7D);

Implement more ByteArray methods using Array generics