Top Description Constructors Methods
org.python.core.util

public Class FileUtil

extends Object
Class Inheritance
Imports
java.io.ByteArrayOutputStream, .File, .IOException, .InputStream, .OutputStream, org.python.core.PyFile

Utility methods for Java file handling.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static File

Returns:

File object for subsequent open
makePrivateRW
(String
to create/control
filename
)

Create the named file (if necessary) and give just the owner read-write access.

public static File

Returns:

File object for subsequent open
makePrivateRW
(File
to create/control
file
)

Create the identified file (if necessary) and give just the owner read-write access.

public static byte[]
readBytes(InputStream in)

Read all bytes from the input stream.

public static PyFile
wrap(InputStream is, String mode, int bufsize)

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

public static PyFile
wrap(InputStream is, String mode)

Creates a PyFile with mode that reads from the InputStream.

public static PyFile
wrap(InputStream is, int bufsize)

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

public static PyFile
wrap(InputStream is)

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

public static PyFile
wrap(OutputStream os, String mode, int bufsize)

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

public static PyFile
wrap(OutputStream os, String mode)

Creates a PyFile with mode that writes to the given OutputStream

public static PyFile
wrap(OutputStream os, int bufsize)

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

public static PyFile
wrap(OutputStream os)

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

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

FileUtilback to summary
public FileUtil()

Method Detail

makePrivateRWback to summary
public static File makePrivateRW(String filename) throws IOException

Create the named file (if necessary) and give just the owner read-write access.

Parameters
filename:String

to create/control

Returns:File

File object for subsequent open

makePrivateRWback to summary
public static File makePrivateRW(File file) throws IOException

Create the identified file (if necessary) and give just the owner read-write access.

Parameters
file:File

to create/control

Returns:File

File object for subsequent open

readBytesback to summary
public static byte[] readBytes(InputStream in) throws 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.

wrapback to summary
public static PyFile wrap(InputStream is, String mode, int bufsize)

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

wrapback to summary
public static PyFile wrap(InputStream is, String mode)

Creates a PyFile with mode that reads from the InputStream.

wrapback to summary
public static PyFile wrap(InputStream is, int bufsize)

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

wrapback to summary
public static PyFile wrap(InputStream is)

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

wrapback to summary
public static PyFile wrap(OutputStream os, String mode, int bufsize)

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

wrapback to summary
public static PyFile wrap(OutputStream os, String mode)

Creates a PyFile with mode that writes to the given OutputStream

wrapback to summary
public static PyFile wrap(OutputStream os, int bufsize)

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

wrapback to summary
public static PyFile wrap(OutputStream os)

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