piranha999
Technical User
Could anybody please tell me how it is possible to read files with an Applet without Security conflicts.
My class looks like this
import java.io.*;
import java.util.*;
import java.net.URL;
public class ReadFile {
private BufferedReader in;
//public String path = "***";
//public String file = "***.***";
public ReadFile() {
try {
in = new BufferedReader(new FileReader(new File(ReadFile.class.getResource("***.***"
.getPath())));
}
catch (IOException e) {}
}
public String readLine() {
String s = null;
try {
s = in.readLine();
}
catch (IOException e) {}
return s;
}
public void close() {
try {
in.close();
}
catch (IOException e) {}
}
public Vector read() {
Vector v = new Vector();
for (String helper = readLine(); helper != null )
{
v.addElement(helper);
helper = readLine();
}
close();
return v;
}
}
My class looks like this
import java.io.*;
import java.util.*;
import java.net.URL;
public class ReadFile {
private BufferedReader in;
//public String path = "***";
//public String file = "***.***";
public ReadFile() {
try {
in = new BufferedReader(new FileReader(new File(ReadFile.class.getResource("***.***"
}
catch (IOException e) {}
}
public String readLine() {
String s = null;
try {
s = in.readLine();
}
catch (IOException e) {}
return s;
}
public void close() {
try {
in.close();
}
catch (IOException e) {}
}
public Vector read() {
Vector v = new Vector();
for (String helper = readLine(); helper != null )
{
v.addElement(helper);
helper = readLine();
}
close();
return v;
}
}