write :: FileSystem -> File -> SB.ByteString -> IO Int
write (FileSystem fs) (File f) b =
  UB.unsafeUseAsCStringLen b $ \(cstr, len) -> do
    written <- throwErrnoIfMinus1 "write" $
                 c_hdfs_write fs f cstr (fromIntegral len)
    return . fromIntegral $ written
write :: FileSystem -> File -> SB.ByteString -> IO Int
write (FileSystem fs) (File f) b =
  UB.unsafeUseAsCStringLen b $ \(cstr, len) -> do
    written <- throwErrnoIfMinus1 "write" $
                 c_hdfs_write fs f cstr (fromIntegral len)
    return . fromIntegral $ written
write (FileSystem fs) (File f) b =
  UB.unsafeUseAsCStringLen b $ \(cstr, len) -> do
    written <- throwErrnoIfMinus1 "write" $
                 c_hdfs_write fs f cstr (fromIntegral len)
    return . fromIntegral $ written