Skip to content

Instantly share code, notes, and snippets.

@mgodave
Created March 16, 2011 03:46
Show Gist options
  • Save mgodave/871978 to your computer and use it in GitHub Desktop.
Save mgodave/871978 to your computer and use it in GitHub Desktop.
Using java.io.FileDescriptor
;; Problem: I have a raw file descriptor, from a parent process and I need to read from it:
(import java.io.FileDescriptor)
(import java.io.FileInputStream)
(def fdfield (.getDeclaredField (Class/forName "java.io.FileDescriptor") "fd"))
(def fd (FileDescriptor.))
(.setInt fdfield fd 10)
(FileInputStream. fd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment