Hi,
You cannot use the regular java IO for res/raw. folder.
only if you are using /sd/card you can use regular java.io
here is some code that might help you
FileInputStream fin = context.openFileInput("sitestore");
InputStreamReader br = new InputStreamReader(fin);
String readString = "";
int i;
while((i = br.read()) != -1){
inputBuffer = (char)i;
readString = readString + inputBuffer;
}
FileOutputStream fOut = context.openFileOutput("sitestore",
context.MODE_WORLD_READABLE);
OutputStreamWriter bw = new OutputStreamWriter(fOut);
write the code for writting to file here...........
Regards,
Yousuf.
On Mon, Dec 14, 2009 at 4:03 PM, kaloer <[email protected]> wrote:
> Hi,
>
> I have a problem when I'm trying to read a file from the res/raw
> folder. When I get the file as an InputStream and try reading it line
> for line with a BufferedReader, I get an IOException when I'm calling
> the br.readLine(). I do no get any additional information in the
> exception.
> Are there anything wrong with this code:
>
>
> private void readFile(InputStream mFile) {
> DataInputStream in = new DataInputStream(mFile);
> BufferedReader br = new BufferedReader(new
> InputStreamReader(in));
> String strLine;
> while ((strLine = br.readLine()) != null) {
> Log.i("line", strLine);
> }
> in.close();
> }
>
> Thank you very much!
>
> //Kaloer
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-beginners%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en