Add allowsReading and allowsWriting methods
This commit is contained in:
parent
f9fc1e8ccf
commit
e85cdf9445
1 changed files with 27 additions and 1 deletions
|
@ -700,7 +700,33 @@ abstract class Stream(
|
||||||
*
|
*
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
READ_WRITE,
|
READ_WRITE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether this mode
|
||||||
|
* allows stream reading.
|
||||||
|
*
|
||||||
|
* @return allows reading?
|
||||||
|
* @since v1-alpha10
|
||||||
|
*/
|
||||||
|
fun allowsReading(): Boolean = when(this) {
|
||||||
|
READ -> true
|
||||||
|
WRITE -> false
|
||||||
|
READ_WRITE -> true
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether this mode
|
||||||
|
* allows stream reading.
|
||||||
|
*
|
||||||
|
* @return allows reading?
|
||||||
|
* @since v1-alpha10
|
||||||
|
*/
|
||||||
|
fun allowsWriting(): Boolean = when(this) {
|
||||||
|
READ -> false
|
||||||
|
WRITE -> true
|
||||||
|
READ_WRITE -> true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue