1313
1414package org .apache .pekko .stream
1515
16- import scala .annotation .nowarn
1716import scala .util .{ Failure , Success , Try }
1817import scala .util .control .NoStackTrace
1918
@@ -26,14 +25,18 @@ import pekko.Done
2625 * @param count Numeric value depending on context, for example IO operations performed or bytes processed.
2726 * @param status Status of the result. Can be either [[pekko.Done ]] or an exception.
2827 */
29- @ nowarn(" msg=deprecated" ) // Status
3028final case class IOResult (
3129 count : Long ,
32- @ deprecated( " status is always set to Success(Done) " , " Akka 2.6.0 " ) status : Try [Done ]) {
30+ status : Try [Done ]) {
3331
32+ /**
33+ * Creates a new IOResult with the given count and the same status.
34+ */
3435 def withCount (value : Long ): IOResult = copy(count = value)
3536
36- @ deprecated(" status is always set to Success(Done)" , " Akka 2.6.0" )
37+ /**
38+ * Creates a new IOResult with the given status and the same count.
39+ */
3740 def withStatus (value : Try [Done ]): IOResult = copy(status = value)
3841
3942 /**
@@ -44,14 +47,12 @@ final case class IOResult(
4447 /**
4548 * Java API: Indicates whether IO operation completed successfully or not.
4649 */
47- @ deprecated(" status is always set to Success(Done)" , " Akka 2.6.0" )
4850 def wasSuccessful : Boolean = status.isSuccess
4951
5052 /**
5153 * Java API: If the IO operation resulted in an error, returns the corresponding [[java.lang.Throwable ]]
5254 * or throws [[UnsupportedOperationException ]] otherwise.
5355 */
54- @ deprecated(" status is always set to Success(Done)" , " Akka 2.6.0" )
5556 def getError : Throwable = status match {
5657 case Failure (t) => t
5758 case Success (_) => throw new UnsupportedOperationException (" IO operation was successful." )
@@ -68,7 +69,6 @@ object IOResult {
6869 new IOResult (count, Success (Done ))
6970
7071 /** JAVA API: Creates failed IOResult, `count` should be the number of bytes (or other unit, please document in your APIs) processed before failing */
71- @ deprecated(" use IOOperationIncompleteException" , " Akka 2.6.0" )
7272 def createFailed (count : Long , ex : Throwable ): IOResult =
7373 new IOResult (count, Failure (ex))
7474}
0 commit comments