Skip to content

Instantly share code, notes, and snippets.

@prof18
Last active January 10, 2019 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prof18/744a179e37b9f29467086a783a742ad6 to your computer and use it in GitHub Desktop.
Save prof18/744a179e37b9f29467086a783a742ad6 to your computer and use it in GitHub Desktop.
object CoroutineEngine {
@Throws(Exception::class)
suspend fun fetchXML(url: String) =
withContext(Dispatchers.IO) {
return@withContext CoreXMLFetcher.fetchXML(url)
}
@Throws(Exception::class)
suspend fun parseXML(xml: Deferred<String>) =
withContext(Dispatchers.IO) {
return@withContext CoreXMLParser.parseXML(xml.await())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment