-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathWorker.kt
More file actions
36 lines (30 loc) · 826 Bytes
/
Worker.kt
File metadata and controls
36 lines (30 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.rules.android.lint.worker
import java.io.IOException
import java.io.PrintStream
interface Worker {
fun processRequests(): Int
interface WorkRequestCallback {
/**
* Processes an individual work request.
*/
fun processWorkRequest(
args: List<String>,
printStream: PrintStream,
): Int
}
interface WorkerMessageProcessor {
@Throws(IOException::class)
fun readWorkRequest(): WorkRequest
@Throws(IOException::class)
fun writeWorkResponse(workResponse: WorkResponse)
}
companion object {
/**
* Creates the appropriate worker instance using the provided worker arguments.
*/
fun fromArgs(
args: Array<String>,
workerMessageProcessor: WorkRequestCallback,
): Worker = InvocationWorker(args, workerMessageProcessor)
}
}