git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] stevedlawrence commented on a change in pull request #61: Base64, gzip, and line-folding layering


stevedlawrence commented on a change in pull request #61: Base64, gzip, and line-folding layering
URL: https://github.com/apache/incubator-daffodil/pull/61#discussion_r185559743
 
 

 ##########
 File path: daffodil-io/src/main/scala/org/apache/daffodil/io/DirectOrBufferedDataOutputStream.scala
 ##########
 @@ -96,11 +96,26 @@ final class DirectOrBufferedDataOutputStream private[io] (var splitFrom: DirectO
     res
   }
 
+  private val layerID: Int = synchronized {
+    if (splitFrom ne null) splitFrom.layerID
+    else {
+      val lid = DirectOrBufferedDataOutputStream.nextLayerID
+      DirectOrBufferedDataOutputStream.nextLayerID += 1
+      lid
+    }
+  }
+
   /**
    * Must be val, as split-from will get reset to null as streams
    * are morphed into direct streams.
    */
-  val id: Int = if (splitFrom == null) 0 else splitFrom.id + 1
+  private val splitID: Int = if (splitFrom == null) 0 else splitFrom.splitID + 1
+
+  /**
+   * id will be a N.M type identifier where N is the layer number,
+   * and M is the splitID.
+   */
+  val id: String = layerID.toString + "." + splitID.toString
 
 Review comment:
   Make def or lazy val? I assume this is only used for debugging?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@xxxxxxxxxxxxxxxx


With regards,
Apache Git Services