javaclass

Annotated java/text.py

114:2420bedaf184
2005-01-10 Paul Boddie Moved the lang module contents into the lang package. Fixed various java.lang and java.io circular imports by introducing a java.lang._object module. Corrected various base classes (object -> java.lang.Object, Exception -> java.lang.Exception) and fixed raising of exceptions in certain cases. Added reflection capabilities.
paul@74 1
#!/usr/bin/env python
paul@74 2
paul@111 3
import java.lang
paul@111 4
paul@111 5
class FilterOutputStream(java.lang.Object):
paul@74 6
    def __init__(self, out):
paul@74 7
        self.out = out
paul@74 8
    def write(self, value, *args):
paul@74 9
        if args:
paul@74 10
            start, length = args
paul@74 11
            self.out.write(value[start:start+length])
paul@74 12
        else:
paul@74 13
            self.out.write(value)
paul@74 14
    def flush(self):
paul@74 15
        self.out.flush()
paul@74 16
    def close(self):
paul@74 17
        self.out.close()
paul@74 18
paul@111 19
class InputStream(java.lang.Object):
paul@74 20
    def read(self, *args):
paul@74 21
        raise NotImplementedError, "read"
paul@74 22
    def skip(self, n):
paul@74 23
        raise NotImplementedError, "skip"
paul@74 24
    def available(self):
paul@74 25
        raise NotImplementedError, "available"
paul@74 26
    def close(self):
paul@74 27
        raise NotImplementedError, "close"
paul@74 28
    def mark(self, readlimit):
paul@74 29
        raise NotImplementedError, "mark"
paul@74 30
    def reset(self):
paul@74 31
        raise NotImplementedError, "reset"
paul@74 32
    def markSupported(self):
paul@74 33
        raise NotImplementedError, "markSupported"
paul@74 34
paul@111 35
class MessageFormat(java.lang.Object):
paul@80 36
    def __init__(self, pattern):
paul@80 37
        self.pattern = pattern
paul@80 38
paul@80 39
    def applyPattern(self, pattern):
paul@80 40
        self.pattern = pattern
paul@80 41
    applyPattern___java__lang__String = applyPattern
paul@80 42
paul@80 43
    def equals(self, obj):
paul@80 44
        return self == obj
paul@80 45
    equals___java__lang__Object = equals
paul@80 46
paul@80 47
    def format(self, *args):
paul@80 48
        raise NotImplementedError, "format"
paul@80 49
    format___java__lang__Object_array____java__lang__StringBuffer___java__text__FieldPosition = format
paul@80 50
    format___java__lang__Object___java__lang__StringBuffer___java__text__FieldPosition = format
paul@80 51
paul@80 52
    def format__static(pattern, arguments):
paul@80 53
        mf = MessageFormat(pattern)
paul@80 54
        # NOTE: To be implemented.
paul@80 55
        return ""
paul@80 56
    format___java__lang__String___java__lang__Object_array_ = staticmethod(format__static)
paul@80 57
paul@80 58
    def getFormats(self):
paul@80 59
        raise NotImplementedError, "getFormats"
paul@80 60
    getFormats___ = getFormats
paul@80 61
paul@80 62
    def getLocale(self):
paul@80 63
        raise NotImplementedError, "getLocale"
paul@80 64
    getLocale___ = getLocale
paul@80 65
    
paul@80 66
setattr(MessageFormat, "__init_____java__lang__String", MessageFormat.__init__)
paul@80 67
paul@111 68
class OutputStream(java.lang.Object):
paul@74 69
    def write(self, b, *args):
paul@74 70
        raise NotImplementedError, "write"
paul@74 71
    def flush(self):
paul@74 72
        raise NotImplementedError, "flush"
paul@74 73
    def close(self):
paul@74 74
        raise NotImplementedError, "close"
paul@74 75
paul@74 76
# vim: tabstop=4 expandtab shiftwidth=4