File Connection API
Hey
I am having problem in JSR-75.
I am reading a file from CFCard byte by byte and then write some bytes to a file.
BUT
When I start the midlet,it asks many times for permission but that can be solved by setting permission but the main problem is that after asking many times it then throws java.lang,security exception.
The code is:
try
{
String extension = ".mpg";
String filePath = "file:///CFCard/B.mpg";
//String Filename ="B.mpg";
String destination = "file:///CFCard/";
String name ="B"; //Filename.substring(0, Filename.length()-4) + "000";
byte[] input = new byte[1024];
FileConnection pRead = (FileConnection)Connector.open(filePath);
InputStream is = pRead.openInputStream();
FileConnection pWrite = (FileConnection)Connector.open(destination+name+extension);
OutputStream ot = pWrite.openOutputStream();
int nLen, nCtr=0;
while((nLen = is.read(input))>0)
{
if(nCtr < nMax)
nCtr++;
else
{
nCtr=0;
pWrite.close();
name = nextFilename(name);
pWrite = (FileConnection)Connector.open(destination+name+extension);
ot = pWrite.openOutputStream();
ot.write(input,0,nLen);
}
pRead.close();
pWrite.close();
}
catch(IOException ioe)
{
ioe.printStackTrace();
}
How to set Permissions for a midlet and how to solve the 'exception' problem.

