I got these errors…
FileManager.java:38: cannot find symbol
symbol : constructor FileInputStream(java.lang.String[])
location: class java.io.FileInputStream
this.readFile = new FileInputStream(fileName);
^
FileManager.java:44: cannot find symbol
symbol : constructor FileOutputStream(java.lang.String[])
location: class java.io.FileOutputStream
this.writeFile = new FileOutputStream(fileName);
^
2 errors
… with this code:
import java.io.*;
public class FileManager
{
private FileInputStream readFile; // file handler
private DataInputStream readStream; // reading stream
private byte readBuffer; // 8 bit reading buffer
private int bitsInReadBuffer; // how many bits are currently in the
// reading buffer
private FileOutputStream writeFile; // file handler
private DataOutputStream writeStream; // writing stream
private byte writeBuffer; // 8 bit writing buffer
private int bitsInWriteBuffer; // how many bits are currently in the
// writing buffer
// ============================================================================
// NAME: FileManager
// INPUT: string of the file name of the file you want to create
// RETURN: none
// PURPOSE: Constructor. Creates a new file. Both read and write buffers
// will be empty.
public FileManager(String[] fileName)
{
try
{
this.readFile = new FileInputStream(fileName);
this.readStream = new DataInputStream(this.readFile);
this.readBuffer = (byte)(0x00);
this.bitsInReadBuffer = 0;
this.writeFile = new FileOutputStream(fileName);
this.writeStream = new DataOutputStream(this.writeFile);
this.writeBuffer = (byte)(0x00);
this.bitsInWriteBuffer = 0;
}
catch(Exception e)
{
System.err.println("Failed initilialize FileManager object");
}
}
// ============================================================================
}
I’m trying to make a program that reads and writes bytes to a file. Apparently, “new” is not recognized. ???