fun save(filename: String?): Boolean { try { mOutput = FileOutputStream(filename) val output = ByteArray(BUFFER_SIZE) while (mInput.available() > 0) { val size: Int = read(output) if (size > 0) { mOutput.write(output, 0, size) } else break } mInput.close() mOutput.close() return true } catch (e: Exception) { e.printStackTrace() } try { if (mInput != null) mInput.close() if (mOutput != null) mOutput.close() } catch (e: IOException) { e.printStackTrace() } return false }
Saves an unencrypted copy of the music file as an Mp3