public long[] getExtendedPixels() { MachineSizedUIntPtr left = new MachineSizedUIntPtr(); MachineSizedUIntPtr right = new MachineSizedUIntPtr(); MachineSizedUIntPtr top = new MachineSizedUIntPtr(); MachineSizedUIntPtr bottom = new MachineSizedUIntPtr(); getExtendedPixels(left, right, top, bottom); return new long[] {left.get(), right.get(), top.get(), bottom.get()}; } /*<methods>*/
public void setVertexBuffers(MTLBuffer[] buffers, long[] offsets, NSRange range) { MTLBuffer.MTLBufferPtr bptr = new MTLBuffer.MTLBufferPtr(); bptr.set(buffers); MachineSizedUIntPtr lptr = new MachineSizedUIntPtr(); lptr.set(offsets); setVertexBuffers(bptr, lptr, range); } public void setVertexTextures(MTLTexture[] textures, NSRange range) {
/** * Copies {@code count} longs from the memory pointed to by this * {@link MachineSizedUIntPtr} to {@code dst} starting at offset {@code offset}. * Does unsigned {@code int} to {@code long} conversion if running on * a 32-bit platform. * * @param dst the destination. * @param offset the offset within the destination array to start copying to. * @param count the number of elements to copy. */ public void get(long[] dst, int offset, int count) { if (_sizeOf() == 8) { asLongBuffer(count).get(dst, offset, count); } else { Arrays.checkOffsetAndCount(dst.length, offset, count); IntBuffer buf = asIntBuffer(count); for (int i = 0; i < count; i++) { dst[i + offset] = ((long) buf.get()) & 0xffffffffL; } } }
/** * Returns a {@link IntBuffer} which reads and writes to the same memory * location pointed to by this {@link MachineSizedUIntPtr}. Must only be * called on 32-bit platforms. * * @param n the maximum number of ints the {@link IntBuffer} can * read/write. This will be the {@link IntBuffer}'s * <code>capacity</code>. * @return the {@link IntBuffer}. * @throws IllegalStateException if this isn't a 32-bit platform. */ public IntBuffer asIntBuffer(int n) { if (_sizeOf() != 4) { throw new IllegalStateException("Not a 32-bit platform"); } return VM.newDirectByteBuffer(getHandle(), n << 2) .order(ByteOrder.nativeOrder()).asIntBuffer(); }
/** * Copies {@code src.length} ints from {@code src} to the memory pointed * to by this {@link MachineSizedUIntPtr}. Does unsigned * {@code int} to {@code long} conversion if running on a 64-bit platform. * * @param src the source. */ public void set(int[] src) { set(src, 0, src.length); }
/** * Copies {@code dst.length} ints from the memory pointed to by this * {@link MachineSizedUIntPtr} to {@code dst}. Does the proper * narrowing {@code long} to {@code int} conversion if running on a 64-bit * platform. * * @param dst the destination. */ public void get(int[] dst) { get(dst, 0, dst.length); }
/** * @throws OSStatusException * @since Available in iOS 4.0 and later. */ public long[] getSampleSizeArray(@MachineSizedSInt long sizeArrayEntries) throws OSStatusException { MachineSizedUIntPtr ptr = new MachineSizedUIntPtr(); OSStatus status = getSampleSizeArray0(sizeArrayEntries, ptr, null); OSStatusException.throwIfNecessary(status); return ptr.toLongArray((int)sizeArrayEntries); } /**
public int[] getIndexes() { int n = (int) getLength(); MachineSizedUIntPtr p = Struct.allocate(MachineSizedUIntPtr.class, n); getIndexes(p); return p.toIntArray(n); } /**
/** * @throws OSStatusException * @since Available in iOS 5.0 and later. */ public String getPeerDomainName() throws OSStatusException { BytePtr peerNamePtr = new BytePtr(); MachineSizedUIntPtr peerNameLenPtr = new MachineSizedUIntPtr(); OSStatus status = getPeerDomainName0(peerNamePtr, peerNameLenPtr); OSStatusException.throwIfNecessary(status); return peerNamePtr.toStringZ(); } /**
/** * Returns a {@link LongBuffer} which reads and writes to the same memory * location pointed to by this {@link MachineSizedUIntPtr}. Must only be * called on 64-bit platforms. * * @param n the maximum number of longs the {@link LongBuffer} can * read/write. This will be the {@link LongBuffer}'s * <code>capacity</code>. * @return the {@link LongBuffer}. * @throws IllegalStateException if this isn't a 64-bit platform. */ public LongBuffer asLongBuffer(int n) { if (_sizeOf() != 8) { throw new IllegalStateException("Not a 64-bit platform"); } return VM.newDirectByteBuffer(getHandle(), n << 3) .order(ByteOrder.nativeOrder()).asLongBuffer(); }
/** * Copies {@code src.length} longs from {@code src} to the memory pointed * to by this {@link MachineSizedUIntPtr}. * Does the proper narrowing {@code long} to {@code int} conversion if running on * a 32-bit platform. * * @param src the source. */ public void set(long[] src) { set(src, 0, src.length); }
/** * Copies {@code dst.length} longs from the memory pointed to by this * {@link MachineSizedUIntPtr} to {@code dst}. Does unsigned {@code int} to * {@code long} conversion if running on a 32-bit platform. * * @param dst the destination. */ public void get(long[] dst) { get(dst, 0, dst.length); }
/** * @since Available in iOS 7.0 and later. */ public int[] getIndexes(NSRange positionRange) { int n = (int) getLength(); MachineSizedUIntPtr p = Struct.allocate(MachineSizedUIntPtr.class, (int)positionRange.getLength()); getIndexes(p, positionRange); return p.toIntArray(n); }
/** * @throws OSStatusException * @since Available in iOS 5.0 and later. */ public String getPeerID() throws OSStatusException { BytePtr.BytePtrPtr peerIDPtr = new BytePtr.BytePtrPtr(); MachineSizedUIntPtr peerIDLenPtr = new MachineSizedUIntPtr(); OSStatus status = getPeerID0(peerIDPtr, peerIDLenPtr); OSStatusException.throwIfNecessary(status); return peerIDPtr.get().toStringZ(); } /**
/** * Copies {@code count} ints from the memory pointed to by this * {@link MachineSizedUIntPtr} to {@code dst} starting at offset {@code offset}. * Does the proper narrowing {@code long} to {@code int} conversion if running on * a 64-bit platform. * * @param dst the destination. * @param offset the offset within the destination array to start copying to. * @param count the number of elements to copy. */ public void get(int[] dst, int offset, int count) { if (_sizeOf() == 4) { asIntBuffer(count).get(dst, offset, count); } else { Arrays.checkOffsetAndCount(dst.length, offset, count); LongBuffer buf = asLongBuffer(count); for (int i = 0; i < count; i++) { dst[i + offset] = (int) buf.get(); } } }
/** * @throws OSStatusException * @since Available in iOS 5.0 and later. */ public long getNumberEnabledCiphers() throws OSStatusException { MachineSizedUIntPtr ptr = new MachineSizedUIntPtr(); OSStatus status = getNumberEnabledCiphers0(ptr); OSStatusException.throwIfNecessary(status); return ptr.get(); } /**
public void setFragmentBuffers(MTLBuffer[] buffers, long[] offsets, NSRange range) { MTLBuffer.MTLBufferPtr bptr = new MTLBuffer.MTLBufferPtr(); bptr.set(buffers); MachineSizedUIntPtr lptr = new MachineSizedUIntPtr(); lptr.set(offsets); setFragmentBuffers(bptr, lptr, range); } public void setFragmentTextures(MTLTexture[] textures, NSRange range) {
/** * Returns a {@link LongBuffer} which reads and writes to the same memory * location pointed to by this {@link MachineSizedUIntPtr}. Must only be * called on 64-bit platforms. * * @param n the maximum number of longs the {@link LongBuffer} can * read/write. This will be the {@link LongBuffer}'s * <code>capacity</code>. * @return the {@link LongBuffer}. * @throws IllegalStateException if this isn't a 64-bit platform. */ public LongBuffer asLongBuffer(int n) { if (_sizeOf() != 8) { throw new IllegalStateException("Not a 64-bit platform"); } return VM.newDirectByteBuffer(getHandle(), n << 3) .order(ByteOrder.nativeOrder()).asLongBuffer(); }
public NSIndexPath(long[] indexes) { super((SkipInit) null); if (indexes == null) { throw new NullPointerException("indexes"); } MachineSizedUIntPtr p = Struct.allocate(MachineSizedUIntPtr.class, indexes.length); p.set(indexes); initObject(init(p, indexes.length)); }
/** * Copies {@code n} ints from the memory pointed to by this * {@link MachineSizedUIntPtr} to a new {@code int[]} instance. Does the * proper narrowing {@code long} to {@code int} conversion if running on a 64-bit * platform. * * @param n the number of ints to copy. * @return the {@code int[]}. */ public int[] toIntArray(int n) { int[] result = new int[n]; get(result); return result; }