Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 20th, 2012  |  syntax: None  |  size: 0.38 KB  |  views: 122  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //Scala Implicit for converting numbers to Little Endian
  2. class RAFImplicit(raf: RandomAccessFile){
  3.         def readShortLE() : Short  = java.lang.Short.reverseBytes(raf.readShort)
  4.         def readIntLE()   : Int    = java.lang.Integer.reverseBytes(raf.readInt)
  5.         def readLongLE()  : Long   = java.lang.Long.reverseBytes(raf.readLong)
  6.        
  7.         implicit def HEtoLE(ra: RandomAccessFile) = new RAFImplicit(raf)
  8. }