If the file name given starts with "//", then the underlying file stream will be constructed using a ZFile on an MVS dataset, otherwise the file will be constructed using java.io.
The default encoding for BufferedReaders and BufferedWriters is the ZUtil.defaultPlatformEncoding for ZFiles, and the default JVM file.encoding property for other files.
This class may be used on non-z/OS platforms so long as MVS filenames are not used, so as to allow for portable text-based IO applications.
see: ZFile
for more information on specifying MVS dataset names
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
getDefaultEncoding
(String filename) Answer the default encoding assumed for a given filenamestatic String
Answer the default encoding for a java.io file encoding, which defaults to the Java System property "file.encoding".static String
Answer the default (EBCDIC) encoding for a ZFilestatic BufferedInputStream
newBufferedInputStream
(String filename) Open a new BufferedInputStream on a file with the given name.static BufferedInputStream
newBufferedInputStream
(String filename, int bsize) Open a new BufferedInputStream on a file with the given name.static BufferedOutputStream
newBufferedOutputStream
(String filename) Open a new BufferedOutputStream on a file with the given name.static BufferedOutputStream
newBufferedOutputStream
(String filename, int bsize) Open a new BufferedOutputStream on a file with the given name and buffer size.static BufferedReader
newBufferedReader
(String filename) Open a new BufferedReader on a file with the given name, default encoding, and a default buffersize.static BufferedReader
newBufferedReader
(String filename, String encoding) Open a new BufferedReader on a file with the given name, encoding, and a default buffersize.static BufferedReader
newBufferedReader
(String filename, String encoding, int bsize) Open a new BufferedReader on a file with the given name, encoding, and buffersize.static BufferedWriter
newBufferedWriter
(String filename) Open a new BufferedWriter on a file with the given name, default encoding, and default buffersize.static BufferedWriter
newBufferedWriter
(String filename, String encoding) Open a new BufferedWriter on a file with the given name, encoding, and default buffersize.static BufferedWriter
newBufferedWriter
(String filename, String encoding, int bsize) Open a new BufferedWriter on a file with the given name, encoding, and buffersize.static InputStream
newInputStream
(String filename) Open a new unbuffered InputStream on a file with the given name.static OutputStream
newOutputStream
(String filename) Open a new unbuffered OutputStream on a file with the given name.
-
Method Details
-
newInputStream
Open a new unbuffered InputStream on a file with the given name.File names starting with "//" are assumed to be MVS datasets and are opened using ZFile. Others are opened with regular java.io files.
NB: the client is responsible for closing this InputStream.
- Throws:
IOException
-
newBufferedInputStream
public static BufferedInputStream newBufferedInputStream(String filename, int bsize) throws IOException Open a new BufferedInputStream on a file with the given name.File names starting with "//" are assumed to be MVS datasets and are opened using ZFile. Others are opened with regular java.io files.
NB: the client is responsible for closing this InputStream.
- Throws:
IOException
-
newBufferedInputStream
Open a new BufferedInputStream on a file with the given name.File names starting with "//" are assumed to be MVS datasets and are opened using ZFile. Others are opened with regular java.io files.
NB: the client is responsible for closing this InputStream.
- Throws:
IOException
-
newOutputStream
Open a new unbuffered OutputStream on a file with the given name.File names starting with "//" are assumed to be MVS datasets and are opened using ZFile. Others are opened with regular java.io files.
NB: the client is responsible for closing this OutputStream.
- Throws:
IOException
-
newBufferedOutputStream
public static BufferedOutputStream newBufferedOutputStream(String filename, int bsize) throws IOException Open a new BufferedOutputStream on a file with the given name and buffer size.File names starting with "//" are assumed to be MVS datasets and are opened using ZFile. Others are opened with regular java.io files.
NB: the client is responsible for closing this OutputStream.
- Throws:
IOException
-
newBufferedOutputStream
Open a new BufferedOutputStream on a file with the given name.File names starting with "//" are assumed to be MVS datasets and are opened using ZFile. Others are opened with regular java.io files.
NB: the client is responsible for closing this OutputStream.
- Throws:
IOException
-
newBufferedReader
public static BufferedReader newBufferedReader(String filename, String encoding, int bsize) throws IOException Open a new BufferedReader on a file with the given name, encoding, and buffersize.File names starting with "//" are assumed to be MVS datasets and are opened using ZFile. Others are opened with regular java.io files.
NB: the client is responsible for closing this reader.
- Throws:
IOException
-
newBufferedReader
Open a new BufferedReader on a file with the given name, encoding, and a default buffersize.File names starting with "//" are assumed to be MVS datasets and are opened using ZFile. Others are opened with regular java.io files.
NB: the client is responsible for closing this reader.
- Throws:
IOException
-
newBufferedReader
Open a new BufferedReader on a file with the given name, default encoding, and a default buffersize.File names starting with "//" are assumed to be MVS datasets and are opened using ZFile. Others are opened with regular java.io files.
NB: the client is responsible for closing this reader.
- Throws:
IOException
-
newBufferedWriter
public static BufferedWriter newBufferedWriter(String filename, String encoding, int bsize) throws IOException Open a new BufferedWriter on a file with the given name, encoding, and buffersize.File names starting with "//" are assumed to be MVS datasets and are opened using ZFile. Others are opened with regular java.io files.
NB: the client is responsible for closing this reader.
- Throws:
IOException
-
newBufferedWriter
Open a new BufferedWriter on a file with the given name, encoding, and default buffersize.File names starting with "//" are assumed to be MVS datasets and are opened using ZFile. Others are opened with regular java.io files.
NB: the client is responsible for closing this reader.
- Throws:
IOException
-
newBufferedWriter
Open a new BufferedWriter on a file with the given name, default encoding, and default buffersize.File names starting with "//" are assumed to be MVS datasets and are opened using ZFile. Others are opened with regular java.io files.
NB: the client is responsible for closing this reader.
- Throws:
IOException
-
getDefaultEncoding
Answer the default encoding assumed for a given filename -
getDefaultZFileEncoding
Answer the default (EBCDIC) encoding for a ZFile -
getDefaultJavaIoEncoding
Answer the default encoding for a java.io file encoding, which defaults to the Java System property "file.encoding".
-