Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
Posts: 27
Registered: ‎07-27-2011
My Device: curve
My Carrier: vodafone

How to Write content into a file ?

hello if someone could explain with a code sniplet , hot to write buffers content into a fale !!

Developer
Posts: 16,740
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to Write content into a file ?

check out the file demo in your eclipse samples folder
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 27
Registered: ‎07-27-2011
My Device: curve
My Carrier: vodafone

Re: How to Write content into a file ?

i can not find any such folder in my eclipse folder, can you please help further

Developer
Posts: 16,740
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to Write content into a file ?

in your eclipse installation folder with this subpath (for example):
plugins\net.rim.ejde.componentpack5.0.0_5.0.0.25\components\samples\com\rim\samples\device\fileexplorerdemo
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 27
Registered: ‎07-27-2011
My Device: curve
My Carrier: vodafone

Re: How to Write content into a file ?

try {
                FileConnection fconn = (FileConnection)Connector.open("file:///hi.part",Connector.READ_WRITE);
                if (!fconn.exists()){
                    fconn.create();
                }
                m_file = fconn;
                DataOutputStream fileOutputStream = fconn.openDataOutputStream();
              
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

 

 

so, here the control is directly comming to the catch block after the first line of the try block i.e. FileConnection fconn = (FileConnection)Connector.open("file:///hi.part",Connector.READ_WRITE);



Developer
Posts: 16,740
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to Write content into a file ?

did you run the sample application? does it work?
if it does, and your app does not, what are you doing different?
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter