1 /*******************************************************************************
2 * Copyright (c) 2000, 2019 IBM Corporation and others.
3 *
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
8 *
9 * SPDX-License-Identifier: EPL-2.0
10 *
11 * Contributors:
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.swt.internal.cocoa;
15
16 public class NSData extends NSObject {
17
NSData()18 public NSData() {
19 super();
20 }
21
NSData(long id)22 public NSData(long id) {
23 super(id);
24 }
25
NSData(id id)26 public NSData(id id) {
27 super(id);
28 }
29
bytes()30 public long bytes() {
31 return OS.objc_msgSend(this.id, OS.sel_bytes);
32 }
33
dataWithBytes(byte[] bytes, long length)34 public static NSData dataWithBytes(byte[] bytes, long length) {
35 long result = OS.objc_msgSend(OS.class_NSData, OS.sel_dataWithBytes_length_, bytes, length);
36 return result != 0 ? new NSData(result) : null;
37 }
38
getBytes(byte[] buffer)39 public void getBytes(byte[] buffer) {
40 OS.objc_msgSend(this.id, OS.sel_getBytes_, buffer);
41 }
42
length()43 public long length() {
44 return OS.objc_msgSend(this.id, OS.sel_length);
45 }
46
47 }
48