BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 06-12-2007, 09:36 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Feb 2007
Location: India
Model: 7100v
Carrier: aittel
Posts: 35
Post Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy persistent storage problem

Please Login to Remove!

I want to store InputStream in persistent storage
Iam using the following code it gives
error
Class java.io.InputStream does not implement net.rim.vm.Persistable

code
Code:
public class persistStream implements Persistable
{
    InputStream input;   
    public static PersistentObject persistStream_store;   
    static 
    {
        persistStream_store = PersistentStore.getPersistentObject(--key--);
    }
public void Store()
        {  --storedata---------}
 public InputStream Retrieve()
        { -------retrieve stream--- }
}
I can somebody tell me what is the problem with the above code
or
Is there any other way to store InputStream data into persistent storage?

Last edited by Rojiwadiya dinesh : 06-12-2007 at 09:37 AM.
Offline  
Old 06-12-2007, 09:58 AM   #2 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

The best way to do that would be to push the inputstream into a String or some other container that is Serializable. You probably wouldn't want to persistently store the input stream anyway for a variety of reasons.
Offline  
Old 06-13-2007, 12:04 AM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Feb 2007
Location: India
Model: 7100v
Carrier: aittel
Posts: 35
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi bemshaswing,
I am receiving Xml data in the form of InputStream from server.I want to
store this Stream and later want to parse it .
Since during parsing I used InputStream ,I used the following code
for parsing.

Code:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
 DocumentBuilder builder = factory.newDocumentBuilder();
 document = builder.parse(inputStream);
 Element rootElement = document.getDocumentElement();
  rootElement.normalize();
 ----------so on----
Is there any other way to parse the xml without using InputStream where
I can use String or ByteArray ?

Thanks,
Dinesh.
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.