package nbmtools

import java.io.InputStream
import java.util.zip.ZipInputStream

object appendExternal {
  def apply(s: String): String = s + ".external"
  def unapply(s: String): Option[String] = {
      if (s.endsWith(".external"))
          Some(s.stripSuffix(".external"))
      else None
  }
}

class NbmInputStream(is: InputStream) extends ZipInputStream(is) {
    override def getNextEntry() = {
        val originalEntry = super.getNextEntry
        originalEntry.getName match {
            case appendExternal(name) => {
                    // TODO
                    originalEntry
            }
            case name => originalEntry
        }
    }
}

package nbmtools

import java.io.InputStream
import java.util.zip.ZipInputStream

class NbmInputStream(is: InputStream) extends ZipInputStream(is) {
    override def getNextEntry() = {
        val originalEntry = super.getNextEntry
        if (originalEntry.getName.endsWith(".external")) {
            // TODO
            originalEntry
        } else originalEntry
    }
}

--- 
+++ 
@@ -3,12 +3,24 @@
 import java.io.InputStream
 import java.util.zip.ZipInputStream
 
+object appendExternal {
+  def apply(s: String): String = s + ".external"
+  def unapply(s: String): Option[String] = {
+      if (s.endsWith(".external"))
+          Some(s.stripSuffix(".external"))
+      else None
+  }
+}
+
 class NbmInputStream(is: InputStream) extends ZipInputStream(is) {
     override def getNextEntry() = {
         val originalEntry = super.getNextEntry
-        if (originalEntry.getName.endsWith(".external")) {
-            // TODO
-            originalEntry
-        } else originalEntry
+        originalEntry.getName match {
+            case appendExternal(name) => {
+                    // TODO
+                    originalEntry
+            }
+            case name => originalEntry
+        }
     }
 }
Use extractor for .external extension