Class PyFile

    • Field Detail

      • TYPE

        public static final PyType TYPE
      • name

        public PyObject name
        The filename
      • mode

        public java.lang.String mode
        The mode string
      • encoding

        public java.lang.String encoding
      • errors

        public java.lang.String errors
      • softspace

        public boolean softspace
        Indicator dictating whether a space should be written to this file on the next print statement (not currently implemented in print )
    • Constructor Detail

      • PyFile

        public PyFile()
      • PyFile

        public PyFile​(PyType subType)
      • PyFile

        public PyFile​(RawIOBase raw,
                      java.lang.String name,
                      java.lang.String mode,
                      int bufsize)
      • PyFile

        public PyFile​(java.io.InputStream istream,
                      java.lang.String name,
                      java.lang.String mode,
                      int bufsize,
                      boolean closefd)
      • PyFile

        public PyFile​(java.io.InputStream istream,
                      java.lang.String mode)
      • PyFile

        public PyFile​(java.io.InputStream istream,
                      int bufsize)
      • PyFile

        public PyFile​(java.io.InputStream istream)
      • PyFile

        public PyFile​(java.io.OutputStream ostream,
                      java.lang.String name,
                      java.lang.String mode,
                      int bufsize,
                      boolean closefd)
      • PyFile

        public PyFile​(java.io.OutputStream ostream,
                      int bufsize)
      • PyFile

        public PyFile​(java.io.OutputStream ostream)
      • PyFile

        public PyFile​(java.lang.String name,
                      java.lang.String mode,
                      int bufsize)
    • Method Detail

      • read

        public PyString read​(int size)
      • readinto

        public int readinto​(PyObject buf)
      • readline

        public PyString readline​(int max)
      • readlines

        public PyObject readlines​(int sizehint)
      • readlines

        public PyObject readlines()
      • __iternext__

        public PyObject __iternext__()
        Description copied from class: PyObject
        Return the next element of the sequence that this is an iterator for. Returns null when the end of the sequence is reached.
        Overrides:
        __iternext__ in class PyObject
      • __enter__

        public PyObject __enter__()
      • __iter__

        public PyObject __iter__()
        Description copied from class: PyObject
        Return an iterator that is used to iterate the element of this sequence. From version 2.2, this method is the primary protocol for looping over sequences.

        If a PyObject subclass should support iteration based in the __finditem__() method, it must supply an implementation of __iter__() like this:

         public PyObject __iter__() {
             return new PySequenceIter(this);
         }
         
        When iterating over a python sequence from java code, it should be done with code like this:
         for (PyObject item : seq.asIterable()) {
             // Do somting with item
         }
         
        Overrides:
        __iter__ in class PyObject
      • xreadlines

        public PyObject xreadlines()
      • write

        public void write​(java.lang.String string)
      • writelines

        public void writelines​(PyObject lines)
      • tell

        public long tell()
      • seek

        public void seek​(long pos,
                         int how)
      • seek

        public void seek​(long pos)
      • flush

        public void flush()
      • close

        public void close()
      • truncate

        public void truncate​(long position)
      • truncate

        public void truncate()
      • isatty

        public boolean isatty()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class PyObject
      • getClosed

        public boolean getClosed()
      • getNewlines

        public PyObject getNewlines()
      • getSoftspace

        public PyObject getSoftspace()
      • setSoftspace

        public void setSoftspace​(PyObject obj)
      • delSoftspace

        public void delSoftspace()
      • __tojava__

        public java.lang.Object __tojava__​(java.lang.Class<?> cls)
        Description copied from class: PyObject
        Equivalent to the Jython __tojava__ method. Tries to coerce this object to an instance of the requested Java class. Returns the special object Py.NoConversion if this PyObject can not be converted to the desired Java class.
        Overrides:
        __tojava__ in class PyObject
        Parameters:
        cls - the Class to convert this PyObject to.