Skip to content

Instantly share code, notes, and snippets.

@ponkotuy
Created June 27, 2015 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ponkotuy/5ad9559cbbe0fa5a4778 to your computer and use it in GitHub Desktop.
Save ponkotuy/5ad9559cbbe0fa5a4778 to your computer and use it in GitHub Desktop.
jpexsのffdecからFlashのimageを取ってくるScala Sample
import java.io._
import com.jpexs.decompiler.flash.SWF
object Main {
def main(args: Array[String]) {
val path = "/home/yosuke/01_01.swf"
val is = new FileInputStream(new File(path))
val swf = new SWF(is, path, "KanColle1_1", false)
val img = swf.getImage(1).getImageData
val os = new FileOutputStream("/home/yosuke/01_01.png")
output(img, os)
}
val BufSize = 1024 * 4
def output(is: InputStream, os: OutputStream): Unit = {
val buf = new Array[Byte](BufSize)
while(is.read(buf) >= 0) {
os.write(buf)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment