File: lang.py

package info (click to toggle)
python-jpype 1.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,308 kB
  • sloc: python: 19,275; cpp: 18,053; java: 8,638; xml: 1,454; makefile: 155; sh: 37
file content (35 lines) | stat: -rw-r--r-- 937 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import jpype


class Thread:
    """ Thread support for Python

    JPype adds  methods to ``java.lang.Thread`` to interact with 
    Python threads.  These methods are all classmethods that 
    act on the current Python thread.
    """

    isAttached = jpype._jthread._JThread.isAttached
    attach = jpype._jthread._JThread.attach
    attachAsDaemon = jpype._jthread._JThread.attachAsDaemon
    detach = jpype._jthread._JThread.detach


class AutoCloseable:
    """ Customizer for ``java.lang.AutoCloseable`` and ``java.io.Closeable``

    This customizer adds support of the ``with`` operator to all Java
    classes that implement the Java ``AutoCloseable`` interface.

    Example:

    .. code-block:: python

        from java.nio.file import Files, Paths
        with Files.newInputStream(Paths.get("foo")) as fd:
          # operate on the input stream

        # Input stream closes at the end of the block.

    """
    ...