/** * Returns a {@link ShortBuffer} which reads and writes to the same memory * location pointed to by this {@link ShortPtr}. * * @param n the maximum number of shorts the {@link ShortBuffer} can * read/write. This will be the {@link ShortBuffer}'s * <code>capacity</code>. * @return the {@link ShortBuffer}. */ public ShortBuffer asShortBuffer(int n) { return as(BytePtr.class).asByteBuffer(n << 1).order(ByteOrder.nativeOrder()).asShortBuffer(); }
/** * Copies {@code count} shorts from {@code src} starting at offset {@code offset} * to the memory pointed to by this {@link ShortPtr}. * * @param src the source. * @param offset the offset within the source array to start copying from. * @param count the number of elements to copy. */ public void set(short[] src, int offset, int count) { asShortBuffer(count).put(src, offset, count); } }
/** * @since Available in iOS 3.2 and later. */ public short[] getGlyphs(short[] characters) { ShortPtr cptr = new ShortPtr(); cptr.set(characters); ShortPtr ptr = new ShortPtr(); getGlyphs(cptr, ptr, characters.length); return ptr.toShortArray(characters.length); } /**
/** * Copies {@code dst.length} shorts from the memory pointed to by this * {@link ShortPtr} to {@code dst}. * * @param dst the destination. */ public void get(short[] dst) { get(dst, 0, dst.length); }
/** * Copies {@code src.length} shorts from {@code src} to the memory pointed to by * this {@link ShortPtr}. * * @param src the source. */ public void set(short[] src) { set(src, 0, src.length); }
/** * @since Available in iOS 3.2 and later. */ public short[] getGlyphs(@ByVal CFRange range) { ShortPtr ptr = new ShortPtr(); getGlyphs(range, ptr); return ptr.toShortArray((int) getGlyphCount()); } /**
public short[] getOutputDataAsShortArray() { ShortPtr ptr = getOutputDataPointer().as(ShortPtr.class); return ptr.toShortArray(getOutputDataSize()); } public char[] getOutputDataAsCharArray() {
/** * @since Available in iOS 3.2 and later. */ public CGSize[] getVerticalTranslations(short[] glyphs) { ShortPtr gptr = new ShortPtr(); gptr.set(glyphs); CGSize.CGSizePtr ptr = new CGSize.CGSizePtr(); getVerticalTranslations(gptr, ptr, glyphs.length); return ptr.get().toArray(glyphs.length); } /**
/** * Copies {@code n} shorts from the memory pointed to by this {@link ShortPtr} * to a new {@code short[]} instance. * * @param n the number of shorts to copy. * @return the {@code short[]}. */ public short[] toShortArray(int n) { short[] result = new short[n]; get(result); return result; }
/** * Creates a new {@link ShortPtr} and initializes it with the specified value. * * @param value the value. */ public ShortPtr(short value) { set(value); }
/** * @since Available in iOS 3.2 and later. */ public short[] getGlyphs(short[] characters) { ShortPtr cptr = new ShortPtr(); cptr.set(characters); ShortPtr ptr = new ShortPtr(); getGlyphs(cptr, ptr, characters.length); return ptr.toShortArray(characters.length); } /**
/** * @throws OSStatusException * @since Available in iOS 5.0 and later. */ public short[] getSupportedCiphers() throws OSStatusException { ShortPtr ciphersPtr = new ShortPtr(); MachineSizedUIntPtr numCiphersPtr = new MachineSizedUIntPtr(); OSStatus status = getSupportedCiphers0(ciphersPtr, numCiphersPtr); OSStatusException.throwIfNecessary(status); return ciphersPtr.toShortArray((int)numCiphersPtr.get()); } /**
public short[] getOutputDataAsShortArray() { ShortPtr ptr = getOutputDataPointer().as(ShortPtr.class); return ptr.toShortArray(getOutputDataSize()); } public char[] getOutputDataAsCharArray() {
/** * @since Available in iOS 3.2 and later. */ public CGRect[] getBoundingRects(CTFontOrientation orientation, short[] glyphs) { ShortPtr gptr = new ShortPtr(); gptr.set(glyphs); CGRect.CGRectPtr ptr = new CGRect.CGRectPtr(); getBoundingRects(orientation, gptr, ptr, glyphs.length); return ptr.get().toArray(glyphs.length); } /**
/** * Copies {@code count} shorts from the memory pointed to by this * {@link ShortPtr} to {@code dst} starting at offset {@code offset}. * * @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(short[] dst, int offset, int count) { asShortBuffer(count).get(dst, offset, count); }