public static NSObject observeConnectionAccepted(NSFileHandle object, final VoidBlock2<NSFileHandle, NSFileHandle> block) { return NSNotificationCenter.getDefaultCenter().addObserver(ConnectionAcceptedNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1<NSNotification>() { @Override public void invoke(NSNotification a) { NSFileHandle f = null; NSDictionary<?, ?> data = a.getUserInfo(); if (data.containsKey(NotificationDataItem())) { f = (NSFileHandle)data.get(NotificationFileHandleItem()); } block.invoke((NSFileHandle)a.getObject(), f); } }); } public static NSObject observeDataAvailable(NSFileHandle object, final VoidBlock1<NSFileHandle> block) {
public static NSObject observeDataAvailable(NSFileHandle object, final VoidBlock1<NSFileHandle> block) { return NSNotificationCenter.getDefaultCenter().addObserver(DataAvailableNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1<NSNotification>() { @Override public void invoke(NSNotification a) { block.invoke((NSFileHandle)a.getObject()); } }); } }
@Override public void invoke(NSNotification a) { NSFileHandle f = null; NSDictionary<?, ?> data = a.getUserInfo(); if (data.containsKey(NotificationDataItem())) { f = (NSFileHandle)data.get(NotificationFileHandleItem()); } block.invoke((NSFileHandle)a.getObject(), f); } });
@Override public void invoke(NSNotification a) { NSData d = null; NSDictionary<?, ?> data = a.getUserInfo(); if (data.containsKey(NotificationDataItem())) { d = (NSData)data.get(NotificationDataItem()); } block.invoke((NSFileHandle)a.getObject(), d); } });
public void acceptConnectionInBackgroundAndNotify(NSRunLoopMode...modes) { List<String> list = new ArrayList<>(); for (NSRunLoopMode mode : modes) { list.add(mode.value().toString()); } acceptConnectionInBackgroundAndNotify(list); } public void waitForDataInBackgroundAndNotify(NSRunLoopMode...modes) {
/** * @since Available in iOS 4.0 and later. */ public static NSFileHandle createForUpdating(NSURL url) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); NSFileHandle result = createForUpdating(url, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /**
/** * @since Available in iOS 4.0 and later. */ public static NSFileHandle createForReading(NSURL url) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); NSFileHandle result = createForReading(url, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /**
/** * @since Available in iOS 4.0 and later. */ public static NSFileHandle createForWriting(NSURL url) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); NSFileHandle result = createForWriting(url, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /**
public static NSObject observeReadToEndOfFileCompletion(NSFileHandle object, final VoidBlock2<NSFileHandle, NSData> block) { return NSNotificationCenter.getDefaultCenter().addObserver(ReadToEndOfFileCompletionNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1<NSNotification>() { @Override public void invoke(NSNotification a) { NSData d = null; NSDictionary<?, ?> data = a.getUserInfo(); if (data.containsKey(NotificationDataItem())) { d = (NSData)data.get(NotificationDataItem()); } block.invoke((NSFileHandle)a.getObject(), d); } }); } public static NSObject observeConnectionAccepted(NSFileHandle object, final VoidBlock2<NSFileHandle, NSFileHandle> block) {
public static NSObject observeReadCompletion(NSFileHandle object, final VoidBlock2<NSFileHandle, NSData> block) { return NSNotificationCenter.getDefaultCenter().addObserver(ReadCompletionNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1<NSNotification>() { @Override public void invoke(NSNotification a) { NSData d = null; NSDictionary<?, ?> data = a.getUserInfo(); if (data.containsKey(NotificationDataItem())) { d = (NSData)data.get(NotificationDataItem()); } block.invoke((NSFileHandle)a.getObject(), d); } }); } public static NSObject observeReadToEndOfFileCompletion(NSFileHandle object, final VoidBlock2<NSFileHandle, NSData> block) {
@Override public void invoke(NSNotification a) { NSData d = null; NSDictionary<?, ?> data = a.getUserInfo(); if (data.containsKey(NotificationDataItem())) { d = (NSData)data.get(NotificationDataItem()); } block.invoke((NSFileHandle)a.getObject(), d); } });
public void acceptConnectionInBackgroundAndNotify(NSRunLoopMode...modes) { List<String> list = new ArrayList<>(); for (NSRunLoopMode mode : modes) { list.add(mode.value().toString()); } acceptConnectionInBackgroundAndNotify(list); } public void waitForDataInBackgroundAndNotify(NSRunLoopMode...modes) {
/** * @since Available in iOS 4.0 and later. */ public static NSFileHandle createForUpdating(NSURL url) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); NSFileHandle result = createForUpdating(url, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /**
/** * @since Available in iOS 4.0 and later. */ public static NSFileHandle createForReading(NSURL url) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); NSFileHandle result = createForReading(url, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /**
/** * @since Available in iOS 4.0 and later. */ public static NSFileHandle createForWriting(NSURL url) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); NSFileHandle result = createForWriting(url, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /**
public static NSObject observeReadToEndOfFileCompletion(NSFileHandle object, final VoidBlock2<NSFileHandle, NSData> block) { return NSNotificationCenter.getDefaultCenter().addObserver(ReadToEndOfFileCompletionNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1<NSNotification>() { @Override public void invoke(NSNotification a) { NSData d = null; NSDictionary<?, ?> data = a.getUserInfo(); if (data.containsKey(NotificationDataItem())) { d = (NSData)data.get(NotificationDataItem()); } block.invoke((NSFileHandle)a.getObject(), d); } }); } public static NSObject observeConnectionAccepted(NSFileHandle object, final VoidBlock2<NSFileHandle, NSFileHandle> block) {
public static NSObject observeReadCompletion(NSFileHandle object, final VoidBlock2<NSFileHandle, NSData> block) { return NSNotificationCenter.getDefaultCenter().addObserver(ReadCompletionNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1<NSNotification>() { @Override public void invoke(NSNotification a) { NSData d = null; NSDictionary<?, ?> data = a.getUserInfo(); if (data.containsKey(NotificationDataItem())) { d = (NSData)data.get(NotificationDataItem()); } block.invoke((NSFileHandle)a.getObject(), d); } }); } public static NSObject observeReadToEndOfFileCompletion(NSFileHandle object, final VoidBlock2<NSFileHandle, NSData> block) {
@Override public void invoke(NSNotification a) { NSFileHandle f = null; NSDictionary<?, ?> data = a.getUserInfo(); if (data.containsKey(NotificationDataItem())) { f = (NSFileHandle)data.get(NotificationFileHandleItem()); } block.invoke((NSFileHandle)a.getObject(), f); } });
@Override public void invoke(NSNotification a) { NSData d = null; NSDictionary<?, ?> data = a.getUserInfo(); if (data.containsKey(NotificationDataItem())) { d = (NSData)data.get(NotificationDataItem()); } block.invoke((NSFileHandle)a.getObject(), d); } });
public static NSObject observeDataAvailable(NSFileHandle object, final VoidBlock1<NSFileHandle> block) { return NSNotificationCenter.getDefaultCenter().addObserver(DataAvailableNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1<NSNotification>() { @Override public void invoke(NSNotification a) { block.invoke((NSFileHandle)a.getObject()); } }); } }