static void exportXmlFile(ByteArrayPayload payload,String path) throws IOException {
  File file=new File(path);
  if (file.exists() && !file.delete()) {
    throw new IOException("Cannot overwrite " + path + ". Perhaps the file is locked?");
  }
  InputStream is=payload.getPayloadStream();
  int len=(int)payload.getLength();
  byte[] data=new byte[len];
  int read=is.read(data,0,len);
  if (read > 0) {
    RandomAccessFile randomAccessFile=null;
    try {
      randomAccessFile=new RandomAccessFile(file,"rws");
      randomAccessFile.write(data);
    }
  finally {
      if (randomAccessFile != null) {
        try {
          randomAccessFile.close();
        }
 catch (        IOException e) {
          Log.e(t,"Error closing RandomAccessFile: " + path,e);
        }
      }
    }
  }
}

static void exportXmlFile ( ByteArrayPayload payload , String path ) throws IOException { File file = new File ( path ) ; if ( file . exists ( ) && ! file . delete ( ) ) { throw new IOException ( "Cannot overwrite " + path + ". Perhaps the file is locked?" ) ; } InputStream is = payload . getPayloadStream ( ) ; int len = ( int ) payload . getLength ( ) ; byte [ ] data = new byte [ len ] ; int read = is . read ( data , 0 , len ) ; if ( read > 0 ) { RandomAccessFile randomAccessFile = null ; try { randomAccessFile = new RandomAccessFile ( file , "rws" ) ; randomAccessFile . write ( data ) ; } finally { if ( randomAccessFile != null ) { try { randomAccessFile . close ( ) ; } catch ( IOException e ) { Log . e ( t , "Error closing RandomAccessFile: " + path , e ) ; } } } } }
this method actually writes the xml to disk .
