Hi,
I am trying to record audio by s40 j2me app and like to store to file system. That file I should be able to access later and play by my app.
Here is the code I am trying but get exception when I use the following line

dos = con.openDataOutputStream();

Code:

    
    private void saveRecordedAudio(boolean aMorningAudioType)    		
    		{
    	 		String fileName  = (aMorningAudioType ==  true) ? "ownMorningAudioType" : "ownotherAudioType";
    	 		
    	 		if(iAudioFileType == null)
    	 		{
    	 			return;
    	 		}
    	 		fileName = fileName +"."+ iAudioFileType;
 
    		
    		    String fullPath = null;
    		    fullPath = System.getProperty("fileconn.dir.private");    		    
    		    if( fullPath.endsWith("/") )
    		        fullPath = fullPath + fileName;
    		    else
    		        fullPath = fullPath + "/" + fileName;
    		    
    		    System.out.println(" >< AudioManager::saveRecordedAudio()   fullPath = "  + fullPath);  
    		    FileConnection con = null;
    		    DataOutputStream dos = null;
    		    try
    		    {
    		    	con = (FileConnection)Connector.open(fullPath,Connector.READ_WRITE);
    		    	if( con.exists() )
    		    	{
    		    		 System.out.println(" >< AudioManager::saveRecordedAudio()   file already there");  
    		    		con.delete();
    		    	}
    		    }
    		    catch (IOException io)
    		    {
    		    System.out.println(">< AudioManager::saveRecordedAudio()  IOException: # 1 "+io.getMessage());
    		    }
    		    catch (SecurityException se)
    		    {
    		    System.out.println(">< AudioManager::saveRecordedAudio() Security exception: # 1" + se.getMessage());
    		    } 
    		    
    		    System.out.println(">< AudioManager::saveRecordedAudio() going to use openDataOutputStream" );
    		    try {
    		    	dos = con.openDataOutputStream();
    		    	System.out.println(">< AudioManager::saveRecordedAudio() ?????This  is throwing  exception ???????????????" );
    		    	dos.write(iRecordedSoundArray);
    		    	
    		    	dos.flush();
    		    	dos.close();
    		    	con.close();
    		    }
       		    catch (IOException io)
    		    {
    		    System.out.println(">< AudioManager::saveRecordedAudio()  openDataOutputStream IOException: # 2"+io.getMessage());
    		    }
    		    catch (SecurityException se)
    		    {
    		    System.out.println(">< AudioManager::saveRecordedAudio() Security exception: # 1" + se.getMessage());
    		    }  
    		    finally {
    		    	con = null;	
    		    	dos = null;
    		    	iUI.SaveOwnAudioFileType(iAudioFileType);    		    	
    		    	System.out.println(" << AudioManager::saveRecordedAudio()   aMorningAudioType = "  + aMorningAudioType);
    		    }
    		}  
    
    
    // support amr, mp3  and wav type
    // given  seconds will be recorded
    public void RecordAudio(boolean aMorningAudioType, int aTimeSeconds){
    	
    	String format = "audio";
    	iAudioState = 1;
    	
    	 String[] s = Manager.getSupportedContentTypes(null);
         for (int i = 0; i<s.length; i++ ) {
             if ( s[i].indexOf(format, 0) != -1 ) {
            	 System.out.println(" <> AudioManager::RecordAudio()   s[i] = " + s[i]  ); 
            	 if(s[i].indexOf("amr") >= 5)
            	 {
            		 iAudioFileType = "amr";
            		 break;
            	 }
            	 if(s[i].indexOf("mp3") >= 5)
            	 {
            		 iAudioFileType = "mp3";
            		 break;
            	 }   
            	 if(s[i].indexOf("wav") >= 5)
            	 {
            		 iAudioFileType = "wav";
            		 break;
            	 }              	 
             }
         }
         
    	
    	try {
    	 player = Manager.createPlayer("capture://audio");
    	  player.realize();  
    	  iRecordControl = (RecordControl)player.getControl("RecordControl");
    	  ByteArrayOutputStream output = new ByteArrayOutputStream();
    	  iRecordControl.setRecordStream(output);  
    	  iRecordControl.startRecord();
    	  player.start();
    	
          long start = System.currentTimeMillis();
          while ((System.currentTimeMillis() - start)/1000 < aTimeSeconds) {             
              Thread.sleep(1000);
          }
             
          player.stop();
          iRecordControl.stopRecord();          
    	  iRecordControl.commit(); 
    	  iRecordedSoundArray = output.toByteArray();  
    	  player.close();
    	  saveRecordedAudio(aMorningAudioType);
    	  
    	  } catch (IOException ioe) {
    		  System.out.println(" >< AudioManager::RecordAudio()  ioe = " + ioe.getMessage() );

    	  } catch (MediaException me) {
    		  System.out.println(" >< AudioManager::RecordAudio()  me = " + me.getMessage() );

    	  } catch (InterruptedException ie) {
    		  System.out.println(" >< AudioManager::RecordAudio()  ie = " + ie.getMessage() );

    	  }    	
    	System.out.println(" << AudioManager::RecordAudio() " );
    }
Thanks for help