summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSInputStream.java
blob: 96c278742bc0999fb7170e13da0370da92f0efdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package org.eclipse.swt.internal.cocoa;

public class NSInputStream extends NSStream {

public NSInputStream() {
	super();
}

public NSInputStream(int id) {
	super(id);
}

public boolean getBuffer(int buffer, int len) {
	return OS.objc_msgSend(this.id, OS.sel_getBuffer_1length_1, buffer, len) != 0;
}

public boolean hasBytesAvailable() {
	return OS.objc_msgSend(this.id, OS.sel_hasBytesAvailable) != 0;
}

public id initWithData(NSData data) {
	int result = OS.objc_msgSend(this.id, OS.sel_initWithData_1, data != null ? data.id : 0);
	return result != 0 ? new id(result) : null;
}

public id initWithFileAtPath(NSString path) {
	int result = OS.objc_msgSend(this.id, OS.sel_initWithFileAtPath_1, path != null ? path.id : 0);
	return result != 0 ? new id(result) : null;
}

public static id inputStreamWithData(NSData data) {
	int result = OS.objc_msgSend(OS.class_NSInputStream, OS.sel_inputStreamWithData_1, data != null ? data.id : 0);
	return result != 0 ? new id(result) : null;
}

public static id inputStreamWithFileAtPath(NSString path) {
	int result = OS.objc_msgSend(OS.class_NSInputStream, OS.sel_inputStreamWithFileAtPath_1, path != null ? path.id : 0);
	return result != 0 ? new id(result) : null;
}

public int read(int buffer, int len) {
	return OS.objc_msgSend(this.id, OS.sel_read_1maxLength_1, buffer, len);
}

}