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

[GitHub] stevedlawrence commented on a change in pull request #61: Preliminary Review - Base64 layering runs first parsing unit test.

stevedlawrence commented on a change in pull request #61: Preliminary Review - Base64 layering runs first parsing unit test.

 File path: daffodil-runtime1-unparser/src/main/scala/org/apache/daffodil/processors/unparsers/LayeredSequenceUnparser.scala
 @@ -0,0 +1,56 @@
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.daffodil.processors.unparsers
+import org.apache.daffodil.processors.{ LayerTransformerEv, ModelGroupRuntimeData }
+class LayeredSequenceUnparser(ctxt: ModelGroupRuntimeData,
+  layerTransformerEv: LayerTransformerEv,
+  childUnparsers: Vector[Unparser])
+  extends SequenceCombinatorUnparser(ctxt, childUnparsers) {
+  override lazy val runtimeDependencies = Seq(layerTransformerEv)
+  override def nom = "LayeredSequence"
+  override def unparse(state: UState): Unit = {
+    val layerTransformer = layerTransformerEv.evaluate(state)
+    val savedDOS = state.dataOutputStream
+    val isAligned = savedDOS.align(layerTransformer.mandatoryLayerAlignmentInBits, state)
+    if (!isAligned)
+      UE(state, "Unable to align to the mandatory layer alignment of %s(bits)",
+        layerTransformer.mandatoryLayerAlignmentInBits)
+    val newDOS = layerTransformer.addLayer(savedDOS, state)
 Review comment:
   Thoughts on reversing the action and changing it to something like this:
       val newDos = savedDOS.addLayer(layerTransformer, state)
   This is kindof how we handle buffered data streams on unparse, e.g.
       val newDOS = currentDos.addBuffered
   Note sure what this affects in the big picture, if anything. Maybe it just affects which class the code is in and doesn't really matter.

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:

With regards,
Apache Git Services