       FileInputStream: [
         o 'available()I', (rs) -> 0 # we never buffer anything, so this is always zero
         o 'readBytes([BII)I', (rs, _this, byte_arr, offset, n_bytes) ->
+            if _this.fields.$file?
+              # this is a real file that we've already opened
+              fs = get_filesystem_module 'fs'
+              data = fs.readSync(_this.fields.$file, n_bytes)[0]
+              byte_arr.array[offset...offset+data.length] = (data.charCodeAt(i) for i in [0...data.length])
+              return data.length
+            # reading from System.in, do it async
+            console.log '>>> reading from Stdin now!'
             result = null # will be filled in after the yield
             rs.curr_frame().resume = -> result
             throw new util.YieldException (cb) ->

                byte_arr.array[offset...offset+bytes.length] = bytes
                result = bytes.length
                cb()
      ]
      ObjectStreamClass: [
        o 'initNative()V', (rs) ->  # NOP
      ]
      UnixFileSystem: [
        o 'getBooleanAttributes0(Ljava/io/File;)I', (rs, _this, file) ->
            try
              fs = require 'fs'
            catch e  #TODO: add a browser-friendly interface to the localstorage psuedo-fs
              util.java_throw 'java/lang/UnsupportedOperationException', 'Filesystem ops are not supported in the browser'
            stats = fs.statSync rs.jvm2js_str rs.get_obj file.fields.path
            return 0 unless stats?
            if stats.isFile() then 3 else if stats.isDirectory() then 5 else 1
        o 'canonicalize0(L!/lang/String;)L!/lang/String;', (rs, _this, jvm_path_str) ->
            try
              path = require 'path'
            catch e
              util.java_throw 'java/lang/UnsupportedOperationException', 'Filesystem ops are not supported in the browser'
            js_str = rs.jvm2js_str jvm_path_str
            rs.init_string path.resolve path.normalize js_str
      ]

    throw "field #{offset} doesn't exist in class #{cls.this_class}" unless cls.super_class?
    cls = rs.class_lookup(cls.super_class)
  cls.fields[offset]

get_filesystem_module = (module_name) ->
  # used for things like 'fs' and 'path'
  try
    mod = require module_name
  catch e  #TODO: add a browser-friendly interface to the localstorage psuedo-fs
    util.java_throw 'java/lang/UnsupportedOperationException', 'Filesystem ops are not supported in the browser'
  mod

stat_file = (fname) ->
  fs = get_filesystem_module 'fs'
  try 
    fs.statSync(fname)
  catch e
    null

native_methods =
  java:
