Package org.python.core.util
Class FileUtil
java.lang.Object
org.python.core.util.FileUtil
Utility methods for Java file handling.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FilemakePrivateRW(File file) Create the identified file (if necessary) and give just the owner read-write access.static FilemakePrivateRW(String filename) Create the named file (if necessary) and give just the owner read-write access.static byte[]readBytes(InputStream in) Read all bytes from the input stream.static PyFilewrap(InputStream is) Creates a PyFile in text mode that reads from the givenInputStream.static PyFilewrap(InputStream is, int bufsize) Creates a PyFile in text mode that reads from the givenInputStreamusing bufsize.static PyFilewrap(InputStream is, String mode) Creates a PyFile with mode that reads from theInputStream.static PyFilewrap(InputStream is, String mode, int bufsize) Creates a PyFile with mode that reads from the givenInputStreamusing bufsize.static PyFilewrap(OutputStream os) Creates a PyFile in text mode that writes to the givenOutputStream.static PyFilewrap(OutputStream os, int bufsize) Creates a PyFile in text mode that writes to the givenOutputStreamwith bufsize.static PyFilewrap(OutputStream os, String mode) Creates a PyFile with mode that writes to the givenOutputStreamstatic PyFilewrap(OutputStream os, String mode, int bufsize) Creates a PyFile with mode that writes to the givenOutputStreamwith the given bufsize.
-
Constructor Details
-
FileUtil
public FileUtil()
-
-
Method Details
-
wrap
Creates a PyFile with mode that reads from the givenInputStreamusing bufsize. -
wrap
Creates a PyFile with mode that reads from theInputStream. -
wrap
Creates a PyFile in text mode that reads from the givenInputStreamusing bufsize. -
wrap
Creates a PyFile in text mode that reads from the givenInputStream. -
wrap
Creates a PyFile with mode that writes to the givenOutputStreamwith the given bufsize. -
wrap
Creates a PyFile with mode that writes to the givenOutputStream -
wrap
Creates a PyFile in text mode that writes to the givenOutputStreamwith bufsize. -
wrap
Creates a PyFile in text mode that writes to the givenOutputStream. -
readBytes
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:
IOException
-
makePrivateRW
Create the named file (if necessary) and give just the owner read-write access.- Parameters:
filename- to create/control- Returns:
Fileobject for subsequent open- Throws:
IOException
-
makePrivateRW
Create the identified file (if necessary) and give just the owner read-write access.- Parameters:
file- to create/control- Returns:
Fileobject for subsequent open- Throws:
IOException
-