org.python.core.util

## Class FileUtil

- java.lang.Object
- - org.python.core.util.FileUtil

-     public class FileUtil
      extends java.lang.Object

  Utility methods for Java file handling.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FileUtil()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.io.File` | `makePrivateRW(java.io.File file)` Create the identified file (if necessary) and give just the owner read-write access.
    `static java.io.File` | `makePrivateRW(java.lang.String filename)` Create the named file (if necessary) and give just the owner read-write access.
    `static byte[]` | `readBytes(java.io.InputStream in)` Read all bytes from the input stream.
    `static PyFile` | `wrap(java.io.InputStream is)` Creates a PyFile in text mode that reads from the given `InputStream`.
    `static PyFile` | `wrap(java.io.InputStream is, int bufsize)` Creates a PyFile in text mode that reads from the given `InputStream` using bufsize.
    `static PyFile` | `wrap(java.io.InputStream is, java.lang.String mode)` Creates a PyFile with mode that reads from the `InputStream`.
    `static PyFile` | `wrap(java.io.InputStream is, java.lang.String mode, int bufsize)` Creates a PyFile with mode that reads from the given `InputStream` using bufsize.
    `static PyFile` | `wrap(java.io.OutputStream os)` Creates a PyFile in text mode that writes to the given `OutputStream`.
    `static PyFile` | `wrap(java.io.OutputStream os, int bufsize)` Creates a PyFile in text mode that writes to the given `OutputStream` with bufsize.
    `static PyFile` | `wrap(java.io.OutputStream os, java.lang.String mode)` Creates a PyFile with mode that writes to the given `OutputStream`
    `static PyFile` | `wrap(java.io.OutputStream os, java.lang.String mode, int bufsize)` Creates a PyFile with mode that writes to the given `OutputStream` with the given bufsize.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FileUtil

          public FileUtil()

  - ### Method Detail

    - #### wrap

          public static PyFile wrap(java.io.InputStream is,
                                    java.lang.String mode,
                                    int bufsize)

      Creates a PyFile with mode that reads from the given `InputStream` using bufsize.

    - #### wrap

          public static PyFile wrap(java.io.InputStream is,
                                    java.lang.String mode)

      Creates a PyFile with mode that reads from the `InputStream`.

    - #### wrap

          public static PyFile wrap(java.io.InputStream is,
                                    int bufsize)

      Creates a PyFile in text mode that reads from the given `InputStream` using bufsize.

    - #### wrap

          public static PyFile wrap(java.io.InputStream is)

      Creates a PyFile in text mode that reads from the given `InputStream`.

    - #### wrap

          public static PyFile wrap(java.io.OutputStream os,
                                    java.lang.String mode,
                                    int bufsize)

      Creates a PyFile with mode that writes to the given `OutputStream` with the given bufsize.

    - #### wrap

          public static PyFile wrap(java.io.OutputStream os,
                                    java.lang.String mode)

      Creates a PyFile with mode that writes to the given `OutputStream`

    - #### wrap

          public static PyFile wrap(java.io.OutputStream os,
                                    int bufsize)

      Creates a PyFile in text mode that writes to the given `OutputStream` with bufsize.

    - #### wrap

          public static PyFile wrap(java.io.OutputStream os)

      Creates a PyFile in text mode that writes to the given `OutputStream`.

    - #### readBytes

          public static byte[] readBytes(java.io.InputStream in)
                                  throws java.io.IOException

      Read all bytes from the input stream.

      Note that using this method to read very large streams could cause out-of-memory exceptions and/or block for large periods of time.

      Throws:
        `java.io.IOException`

    - #### makePrivateRW

          public static java.io.File makePrivateRW(java.lang.String filename)
                                            throws java.io.IOException

      Create the named file (if necessary) and give just the owner read-write access.
      Parameters:
        `filename` - to create/control
      Returns:
        `File` object for subsequent open
      Throws:
        `java.io.IOException`

    - #### makePrivateRW

          public static java.io.File makePrivateRW(java.io.File file)
                                            throws java.io.IOException

      Create the identified file (if necessary) and give just the owner read-write access.
      Parameters:
        `file` - to create/control
      Returns:
        `File` object for subsequent open
      Throws:
        `java.io.IOException`

Jython homepage