EZMusicBoxSDK/src/main/java/com/wms/ezmusicbox/sdk/streaming/StreamingMediaPlayer.java
/**
     *  Move the file from oldLocation to newLocation.
     */
Move the file from oldLocation to newLocation.
Move the file from oldLocation to newLocation .
private void moveFile(File oldLocation, File newLocation) throws IOException {
		if (oldLocation.exists()) {
			BufferedInputStream reader = null;
			BufferedOutputStream writer = null;
			try {
				reader = new BufferedInputStream(new FileInputStream(oldLocation));
				writer = new BufferedOutputStream(new FileOutputStream(newLocation, false));
			    byte[]  buff = new byte[8192];
			    int numChars = 0;
			    while ((numChars = reader.read(buff, 0, buff.length)) != -1) {
			    	writer.write(buff, 0, numChars);
			    }
			}
			catch( IOException ex ) {
				throw new IOException("IOException when transferring " + oldLocation.getPath() + " to " + newLocation.getPath());
			}
			finally {
				try {
					if (reader != null) {
						reader.close();
				    }
					if(writer != null) {
						writer.close();
					}
				}
				catch( IOException ex ){
					Log.e(getClass().getName(),"Error closing files when transferring " + oldLocation.getPath() + " to " + newLocation.getPath()); 
				}
			}
        }
		else {
			throw new IOException("Old location does not exist when transferring " + oldLocation.getPath() + " to " + newLocation.getPath());
        }
	}
private void moveFile ( File oldLocation , File newLocation ) throws IOException { if ( oldLocation . exists ( ) ) { BufferedInputStream reader = null ; BufferedOutputStream writer = null ; try { reader = new BufferedInputStream ( new FileInputStream ( oldLocation ) ) ; writer = new BufferedOutputStream ( new FileOutputStream ( newLocation , false ) ) ; byte [ ] buff = new byte [ 8192 ] ; int numChars = 0 ; while ( ( numChars = reader . read ( buff , 0 , buff . length ) ) != - 1 ) { writer . write ( buff , 0 , numChars ) ; } } catch ( IOException ex ) { throw new IOException ( "IOException when transferring " + oldLocation . getPath ( ) + " to " + newLocation . getPath ( ) ) ; } finally { try { if ( reader != null ) { reader . close ( ) ; } if ( writer != null ) { writer . close ( ) ; } } catch ( IOException ex ) { Log . e ( getClass ( ) . getName ( ) , "Error closing files when transferring " + oldLocation . getPath ( ) + " to " + newLocation . getPath ( ) ) ; } } } else { throw new IOException ( "Old location does not exist when transferring " + oldLocation . getPath ( ) + " to " + newLocation . getPath ( ) ) ; } }
Move the file from oldLocation to newLocation.
Move the file from oldLocation to newLocation .