Java Code Examples for java.nio.ByteBuffer.position()

The following are Jave code examples for showing how to use position() of the java.nio.ByteBuffer class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: openjdk-jdk10   File: DirectByteBufferTest.java   View Source Code Vote up 6 votes
byte[] alignedWriteSnippet(byte a, byte b, short c, int d, long e, double f, float g) {
    byte[] ret = new byte[28];
    ByteBuffer buffer = makeDirect(28, byteOrder);

    buffer.put(a);
    buffer.put(b);
    buffer.putShort(c);
    buffer.putInt(d);
    buffer.putLong(e);
    buffer.putDouble(f);
    buffer.putFloat(g);

    buffer.position(0);
    buffer.get(ret);

    return ret;
}
 
Example 2
Project: openaudible   File: Mp4TagWriter.java   View Source Code Vote up 6 votes
/**
 * When the size of the metadata has changed and it cant be compensated for by free atom
 * we have to adjust the size of the size field upto the moovheader level for the udta atom and
 * its child meta atom.
 *
 * @param moovHeader
 * @param moovBuffer
 * @param sizeAdjustment can be negative or positive     *
 * @param udtaHeader
 * @param metaHeader
 * @return
 * @throws java.io.IOException
 */
private void adjustSizeOfMoovHeader
(Mp4BoxHeader moovHeader,
 ByteBuffer moovBuffer,
 int sizeAdjustment,
 Mp4BoxHeader udtaHeader,
 Mp4BoxHeader metaHeader) throws IOException {
    //Adjust moov header size, adjusts the underlying buffer
    moovHeader.setLength(moovHeader.getLength() + sizeAdjustment);

    //Edit the fields in moovBuffer (note moovbuffer doesnt include header)
    if (udtaHeader != null) {
        //Write the updated udta atom header to moov buffer
        udtaHeader.setLength(udtaHeader.getLength() + sizeAdjustment);
        moovBuffer.position((int) (udtaHeader.getFilePos() - moovHeader.getFilePos() - Mp4BoxHeader.HEADER_LENGTH));
        moovBuffer.put(udtaHeader.getHeaderData());
    }

    if (metaHeader != null) {
        //Write the updated udta atom header to moov buffer
        metaHeader.setLength(metaHeader.getLength() + sizeAdjustment);
        moovBuffer.position((int) (metaHeader.getFilePos() - moovHeader.getFilePos() - Mp4BoxHeader.HEADER_LENGTH));
        moovBuffer.put(metaHeader.getHeaderData());
    }
}
 
Example 3
Project: ss-android   File: HttpConnectTunnel.java   View Source Code Vote up 6 votes
@Override
protected void afterReceived(ByteBuffer buffer) throws Exception {
    if (!m_TunnelEstablished) {
        //收到代理服务器响应数据
        //分析响应并判断是否连接成功
        String response = new String(buffer.array(), buffer.position(), 12);
        if (response.matches("^HTTP/1.[01] 200$")) {
            buffer.limit(buffer.position());
        } else {
            throw new Exception(String.format("Proxy server responsed an error: %s", response));
        }

        m_TunnelEstablished = true;
        super.onTunnelEstablished();
    }
}
 
Example 4
Project: OpenJSharp   File: Base64.java   View Source Code Vote up 6 votes
/**
 * Decodes all bytes from the input byte buffer using the {@link Base64}
 * encoding scheme, writing the results into a newly-allocated ByteBuffer.
 *
 * <p> Upon return, the source buffer's position will be updated to
 * its limit; its limit will not have been changed. The returned
 * output buffer's position will be zero and its limit will be the
 * number of resulting decoded bytes
 *
 * <p> {@code IllegalArgumentException} is thrown if the input buffer
 * is not in valid Base64 encoding scheme. The position of the input
 * buffer will not be advanced in this case.
 *
 * @param   buffer
 *          the ByteBuffer to decode
 *
 * @return  A newly-allocated byte buffer containing the decoded bytes
 *
 * @throws  IllegalArgumentException
 *          if {@code src} is not in valid Base64 scheme.
 */
public ByteBuffer decode(ByteBuffer buffer) {
    int pos0 = buffer.position();
    try {
        byte[] src;
        int sp, sl;
        if (buffer.hasArray()) {
            src = buffer.array();
            sp = buffer.arrayOffset() + buffer.position();
            sl = buffer.arrayOffset() + buffer.limit();
            buffer.position(buffer.limit());
        } else {
            src = new byte[buffer.remaining()];
            buffer.get(src);
            sp = 0;
            sl = src.length;
        }
        byte[] dst = new byte[outLength(src, sp, sl)];
        return ByteBuffer.wrap(dst, 0, decode0(src, sp, sl, dst));
    } catch (IllegalArgumentException iae) {
        buffer.position(pos0);
        throw iae;
    }
}
 
Example 5
Project: boohee_v5.6   File: ca.java   View Source Code Vote up 6 votes
public static void a(ByteBuffer byteBuffer, StringBuilder stringBuilder) {
    byte[] array = byteBuffer.array();
    int arrayOffset = byteBuffer.arrayOffset();
    int position = arrayOffset + byteBuffer.position();
    int limit = byteBuffer.limit() + arrayOffset;
    if (limit - position > 128) {
        arrayOffset = position + 128;
    } else {
        arrayOffset = limit;
    }
    for (int i = position; i < arrayOffset; i++) {
        if (i > position) {
            stringBuilder.append(" ");
        }
        stringBuilder.append(a(array[i]));
    }
    if (limit != arrayOffset) {
        stringBuilder.append("...");
    }
}
 
Example 6
Project: rmq4note   File: MessageClientIDSetter.java   View Source Code Vote up 5 votes
private static byte[] createUniqIDBuffer() {
    ByteBuffer buffer = ByteBuffer.allocate(4 + 2);
    long current = System.currentTimeMillis();
    if (current >= nextStartTime) {
        setStartTime(current);
    }
    buffer.position(0);
    buffer.putInt((int) (System.currentTimeMillis() - startTime));
    buffer.putShort((short) COUNTER.getAndIncrement());
    return buffer.array();
}
 
Example 7
Project: DStream   File: MyScheme.java   View Source Code Vote up 5 votes
public static String deserializeString(ByteBuffer string) {
    if (string.hasArray()) {
        int base = string.arrayOffset();
        return new String(string.array(), base + string.position(), string.remaining());
    } else {
        return new String(Utils.toByteArray(string), UTF8_CHARSET);
    }
}
 
Example 8
Project: smb-nio   File: SeekableSMBByteChannel.java   View Source Code Vote up 5 votes
/**
 * Writes the content of the provided {@link ByteBuffer} into the {@link SmbRandomAccessFile} handled by the current
 * instance of {@link SeekableSMBByteChannel}. The {@link ByteBuffer} is read from its current position to it end.
 *
 * @param src {@link ByteBuffer} from which to read the data.
 * @return Number of bytes that were written.
 * @throws IOException If something goes wrong while writing to the file.
 */
@Override
public synchronized int write(ByteBuffer src) throws IOException {
    if (!this.open) throw new ClosedChannelException();
    final int len = src.limit() - src.position();
    final byte[] buffer = new byte[len];
    src.get(buffer);
    this.random.write(buffer);
    return len;
}
 
Example 9
Project: openjdk-jdk10   File: ZipFileSystem.java   View Source Code Vote up 5 votes
public int read(byte b[], int off, int len) throws IOException {
    ensureOpen();
    initDataPos();
    if (rem == 0) {
        return -1;
    }
    if (len <= 0) {
        return 0;
    }
    if (len > rem) {
        len = (int) rem;
    }
    // readFullyAt()
    long n = 0;
    ByteBuffer bb = ByteBuffer.wrap(b);
    bb.position(off);
    bb.limit(off + len);
    synchronized(zfch) {
        n = zfch.position(pos).read(bb);
    }
    if (n > 0) {
        pos += n;
        rem -= n;
    }
    if (rem == 0) {
        close();
    }
    return (int)n;
}
 
Example 10
Project: jdk8u-jdk   File: DoubleByte.java   View Source Code Vote up 5 votes
protected CoderResult decodeArrayLoop(ByteBuffer src, CharBuffer dst) {
    byte[] sa = src.array();
    int sp = src.arrayOffset() + src.position();
    int sl = src.arrayOffset() + src.limit();

    char[] da = dst.array();
    int dp = dst.arrayOffset() + dst.position();
    int dl = dst.arrayOffset() + dst.limit();

    try {
        while (sp < sl && dp < dl) {
            // inline the decodeSingle/Double() for better performance
            int inSize = 1;
            int b1 = sa[sp] & 0xff;
            char c = b2cSB[b1];
            if (c == UNMAPPABLE_DECODING) {
                if (sl - sp < 2)
                    return crMalformedOrUnderFlow(b1);
                int b2 = sa[sp + 1] & 0xff;
                if (b2 < b2Min || b2 > b2Max ||
                    (c = b2c[b1][b2 - b2Min]) == UNMAPPABLE_DECODING) {
                    return crMalformedOrUnmappable(b1, b2);
                }
                inSize++;
            }
            da[dp++] = c;
            sp += inSize;
        }
        return (sp >= sl) ? CoderResult.UNDERFLOW
                          : CoderResult.OVERFLOW;
    } finally {
        src.position(sp - src.arrayOffset());
        dst.position(dp - dst.arrayOffset());
    }
}
 
Example 11
Project: Hotspot-master-devp   File: ScreenRecorder.java   View Source Code Vote up 5 votes
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private void encodeToVideoTrack(int index) {
    ByteBuffer encodedData = mEncoder.getOutputBuffer(index);

    if ((mBufferInfo.flags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG) != 0) {
        // The codec config data was pulled out and fed to the muxer when we got
        // the INFO_OUTPUT_FORMAT_CHANGED status.
        // Ignore it.
        Log.d(TAG, "ignoring BUFFER_FLAG_CODEC_CONFIG");
        mBufferInfo.size = 0;
    }
    if (mBufferInfo.size == 0) {
        Log.d(TAG, "info.size == 0, drop it.");
        encodedData = null;
    } else {
        Log.d(TAG, "got buffer, info: size=" + mBufferInfo.size
                + ", presentationTimeUs=" + mBufferInfo.presentationTimeUs
                + ", offset=" + mBufferInfo.offset);
    }
    if (encodedData != null) {
        encodedData.position(mBufferInfo.offset);
        encodedData.limit(mBufferInfo.offset + mBufferInfo.size);
        mMuxer.writeSampleData(mVideoTrackIndex, encodedData, mBufferInfo);
        Log.i(TAG, "sent mBufferInfo.offset" + mBufferInfo.offset + " bytes to muxer...");
        Log.i(TAG, "sent mBufferInfo.size" + mBufferInfo.size + " bytes to muxer...");
    }
}
 
Example 12
Project: kafka-0.11.0.0-src-with-comment   File: MemoryRecordsBuilderTest.java   View Source Code Vote up 5 votes
@Test(expected = IllegalArgumentException.class)
public void testWriteEndTxnMarkerNonControlBatch() {
    ByteBuffer buffer = ByteBuffer.allocate(128);
    buffer.position(bufferOffset);

    long pid = 9809;
    short epoch = 15;
    int sequence = RecordBatch.NO_SEQUENCE;

    MemoryRecordsBuilder builder = new MemoryRecordsBuilder(buffer, RecordBatch.CURRENT_MAGIC_VALUE, compressionType, TimestampType.CREATE_TIME,
            0L, 0L, pid, epoch, sequence, true, false, RecordBatch.NO_PARTITION_LEADER_EPOCH, buffer.capacity());
    builder.appendEndTxnMarker(RecordBatch.NO_TIMESTAMP, new EndTransactionMarker(ControlRecordType.ABORT, 0));
}
 
Example 13
Project: OpenJSharp   File: X11KSC5601.java   View Source Code Vote up 5 votes
protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
    char[] sa = src.array();
    int sp = src.arrayOffset() + src.position();
    int sl = src.arrayOffset() + src.limit();
    byte[] da = dst.array();
    int dp = dst.arrayOffset() + dst.position();
    int dl = dst.arrayOffset() + dst.limit();

    try {
        while (sp < sl) {
            char c = sa[sp];
            if (c <= '\u007f')
                return CoderResult.unmappableForLength(1);
            int ncode = encodeDouble(c);
            if (ncode != 0 && c != '\u0000' ) {
                da[dp++] = (byte) ((ncode  >> 8) & 0x7f);
                da[dp++] = (byte) (ncode & 0x7f);
                sp++;
                continue;
            }
            return CoderResult.unmappableForLength(1);
        }
        return CoderResult.UNDERFLOW;
    } finally {
        src.position(sp - src.arrayOffset());
        dst.position(dp - dst.arrayOffset());
    }
}
 
Example 14
Project: hadoop   File: SnappyDecompressor.java   View Source Code Vote up 5 votes
int decompressDirect(ByteBuffer src, ByteBuffer dst) throws IOException {
  assert (this instanceof SnappyDirectDecompressor);
  
  ByteBuffer presliced = dst;
  if (dst.position() > 0) {
    presliced = dst;
    dst = dst.slice();
  }

  Buffer originalCompressed = compressedDirectBuf;
  Buffer originalUncompressed = uncompressedDirectBuf;
  int originalBufferSize = directBufferSize;
  compressedDirectBuf = src.slice();
  compressedDirectBufLen = src.remaining();
  uncompressedDirectBuf = dst;
  directBufferSize = dst.remaining();
  int n = 0;
  try {
    n = decompressBytesDirect();
    presliced.position(presliced.position() + n);
    // SNAPPY always consumes the whole buffer or throws an exception
    src.position(src.limit());
    finished = true;
  } finally {
    compressedDirectBuf = originalCompressed;
    uncompressedDirectBuf = originalUncompressed;
    compressedDirectBufLen = 0;
    directBufferSize = originalBufferSize;
  }
  return n;
}
 
Example 15
Project: BiglyBT   File: SHA1.java   View Source Code Vote up 5 votes
/**
 * Starts or continues a SHA-1 message digest calculation.
 * Only the remaining bytes of the given ByteBuffer are used.
 * @param buffer input data
 */
public void update(ByteBuffer buffer) {
	length += buffer.remaining();
	//Save current position to leave given buffer unchanged
	int position = buffer.position();

	//Complete the final buffer if needed
	completeFinalBuffer(buffer);

	if(!buffer.hasArray() || buffer.isDirect())
	{
		if(cacheBlock == null) // only allocate if we process direct byte buffers
			cacheBlock = new byte[cacheSize];
		while(buffer.remaining() >= 64)
		{
			int toProcess = Math.min(buffer.remaining()-buffer.remaining()%64,cacheSize);
			buffer.get(cacheBlock, 0, toProcess);
			for(int i = 0;i < toProcess; i+=64)
				transform(cacheBlock,i);
		}
	} else // use direct array access for heap buffers
	{
		final int endPos = buffer.position()+buffer.remaining()-buffer.remaining()%64;
		final int internalEndPos = endPos+buffer.arrayOffset();
		for(int i = buffer.arrayOffset()+buffer.position();i < internalEndPos;i+=64)
			transform(buffer.array(),i);
		buffer.position(endPos);
	}


	if(buffer.remaining() != 0) {
		finalBuffer.put(buffer);
	}

	buffer.position(position);
}
 
Example 16
Project: kafka-0.11.0.0-src-with-comment   File: Type.java   View Source Code Vote up 5 votes
@Override
public void write(ByteBuffer buffer, Object o) {
    ByteBuffer arg = (ByteBuffer) o;
    int pos = arg.position();
    buffer.putInt(arg.remaining());
    buffer.put(arg);
    arg.position(pos);
}
 
Example 17
Project: jdk8u-jdk   File: LinuxUserDefinedFileAttributeView.java   View Source Code Vote up 4 votes
@Override
public int write(String name, ByteBuffer src) throws IOException {
    if (System.getSecurityManager() != null)
        checkAccess(file.getPathForPermissionCheck(), false, true);

    int pos = src.position();
    int lim = src.limit();
    assert (pos <= lim);
    int rem = (pos <= lim ? lim - pos : 0);

    NativeBuffer nb;
    long address;
    if (src instanceof sun.nio.ch.DirectBuffer) {
        nb = null;
        address = ((sun.nio.ch.DirectBuffer)src).address() + pos;
    } else {
        // substitute with native buffer
        nb = NativeBuffers.getNativeBuffer(rem);
        address = nb.address();

        if (src.hasArray()) {
            // copy from backing array into buffer
            int off = src.arrayOffset() + pos + Unsafe.ARRAY_BYTE_BASE_OFFSET;
            unsafe.copyMemory(src.array(), off, null, address, rem);
        } else {
            // backing array not accessible so transfer via temporary array
            byte[] tmp = new byte[rem];
            src.get(tmp);
            src.position(pos);  // reset position as write may fail
            unsafe.copyMemory(tmp, Unsafe.ARRAY_BYTE_BASE_OFFSET, null,
                address, rem);
        }
    }

    int fd = file.openForAttributeAccess(followLinks);
    try {
        try {
            fsetxattr(fd, nameAsBytes(file,name), address, rem);
            src.position(pos + rem);
            return rem;
        } catch (UnixException x) {
            throw new FileSystemException(file.getPathForExceptionMessage(),
                null, "Error writing extended attribute '" + name + "': " +
                x.getMessage());
        } finally {
            close(fd);
        }
    } finally {
        if (nb != null)
            nb.release();
    }
}
 
Example 18
Project: FApkSigner   File: ByteBufferBerDataValueReader.java   View Source Code Vote up 4 votes
@Override
public BerDataValue readDataValue() throws BerDataValueFormatException {
    int startPosition = mBuf.position();
    if (!mBuf.hasRemaining()) {
        return null;
    }
    byte firstIdentifierByte = mBuf.get();
    int tagNumber = readTagNumber(firstIdentifierByte);
    boolean constructed = BerEncoding.isConstructed(firstIdentifierByte);

    if (!mBuf.hasRemaining()) {
        throw new BerDataValueFormatException("Missing length");
    }
    int firstLengthByte = mBuf.get() & 0xff;
    int contentsLength;
    int contentsOffsetInTag;
    if ((firstLengthByte & 0x80) == 0) {
        // short form length
        contentsLength = readShortFormLength(firstLengthByte);
        contentsOffsetInTag = mBuf.position() - startPosition;
        skipDefiniteLengthContents(contentsLength);
    } else if (firstLengthByte != 0x80) {
        // long form length
        contentsLength = readLongFormLength(firstLengthByte);
        contentsOffsetInTag = mBuf.position() - startPosition;
        skipDefiniteLengthContents(contentsLength);
    } else {
        // indefinite length -- value ends with 0x00 0x00
        contentsOffsetInTag = mBuf.position() - startPosition;
        contentsLength =
                constructed
                        ? skipConstructedIndefiniteLengthContents()
                        : skipPrimitiveIndefiniteLengthContents();
    }

    // Create the encoded data value ByteBuffer
    int endPosition = mBuf.position();
    mBuf.position(startPosition);
    int bufOriginalLimit = mBuf.limit();
    mBuf.limit(endPosition);
    ByteBuffer encoded = mBuf.slice();
    mBuf.position(mBuf.limit());
    mBuf.limit(bufOriginalLimit);

    // Create the encoded contents ByteBuffer
    encoded.position(contentsOffsetInTag);
    encoded.limit(contentsOffsetInTag + contentsLength);
    ByteBuffer encodedContents = encoded.slice();
    encoded.clear();

    return new BerDataValue(
            encoded,
            encodedContents,
            BerEncoding.getTagClass(firstIdentifierByte),
            constructed,
            tagNumber);
}
 
Example 19
Project: MetadataEditor   File: ID3v11Tag.java   View Source Code Vote up 4 votes
/**
 * Read in a tag from the ByteBuffer
 *
 * @param byteBuffer from where to read in a tag
 * @throws TagNotFoundException if unable to read a tag in the byteBuffer
 */
public void read(ByteBuffer byteBuffer) throws TagNotFoundException
{
    if (!seek(byteBuffer))
    {
        throw new TagNotFoundException("ID3v1 tag not found");
    }
    logger.finer("Reading v1.1 tag");

    //Do single file read of data to cut down on file reads
    byte[] dataBuffer = new byte[TAG_LENGTH];
    byteBuffer.position(0);
    byteBuffer.get(dataBuffer, 0, TAG_LENGTH);
    title = new String(dataBuffer, FIELD_TITLE_POS, FIELD_TITLE_LENGTH, StandardCharsets.ISO_8859_1).trim();
    Matcher m = AbstractID3v1Tag.endofStringPattern.matcher(title);
    if (m.find())
    {
        title = title.substring(0, m.start());
    }
    artist = new String(dataBuffer, FIELD_ARTIST_POS, FIELD_ARTIST_LENGTH, StandardCharsets.ISO_8859_1).trim();
    m = AbstractID3v1Tag.endofStringPattern.matcher(artist);
    if (m.find())
    {
        artist = artist.substring(0, m.start());
    }
    album = new String(dataBuffer, FIELD_ALBUM_POS, FIELD_ALBUM_LENGTH, StandardCharsets.ISO_8859_1).trim();
    m = AbstractID3v1Tag.endofStringPattern.matcher(album);
    if (m.find())
    {
        album = album.substring(0, m.start());
    }
    year = new String(dataBuffer, FIELD_YEAR_POS, FIELD_YEAR_LENGTH, StandardCharsets.ISO_8859_1).trim();
    m = AbstractID3v1Tag.endofStringPattern.matcher(year);
    if (m.find())
    {
        year = year.substring(0, m.start());
    }
    comment = new String(dataBuffer, FIELD_COMMENT_POS, FIELD_COMMENT_LENGTH, StandardCharsets.ISO_8859_1).trim();
    m = AbstractID3v1Tag.endofStringPattern.matcher(comment);
    if (m.find())
    {
        comment = comment.substring(0, m.start());
    }
    track = dataBuffer[FIELD_TRACK_POS];
    genre = dataBuffer[FIELD_GENRE_POS];
}
 
Example 20
Project: OpenJSharp   File: CMap.java   View Source Code Vote up 4 votes
CMapFormat4(ByteBuffer bbuffer, int offset, char[] xlat) {

            this.xlat = xlat;

            bbuffer.position(offset);
            CharBuffer buffer = bbuffer.asCharBuffer();
            buffer.get(); // skip, we already know format=4
            int subtableLength = buffer.get();
            /* Try to recover from some bad fonts which specify a subtable
             * length that would overflow the byte buffer holding the whole
             * cmap table. If this isn't a recoverable situation an exception
             * may be thrown which is caught higher up the call stack.
             * Whilst this may seem lenient, in practice, unless the "bad"
             * subtable we are using is the last one in the cmap table we
             * would have no way of knowing about this problem anyway.
             */
            if (offset+subtableLength > bbuffer.capacity()) {
                subtableLength = bbuffer.capacity() - offset;
            }
            buffer.get(); // skip language
            segCount = buffer.get()/2;
            int searchRange = buffer.get();
            entrySelector = buffer.get();
            rangeShift    = buffer.get()/2;
            startCount = new char[segCount];
            endCount = new char[segCount];
            idDelta = new short[segCount];
            idRangeOffset = new char[segCount];

            for (int i=0; i<segCount; i++) {
                endCount[i] = buffer.get();
            }
            buffer.get(); // 2 bytes for reserved pad
            for (int i=0; i<segCount; i++) {
                startCount[i] = buffer.get();
            }

            for (int i=0; i<segCount; i++) {
                idDelta[i] = (short)buffer.get();
            }

            for (int i=0; i<segCount; i++) {
                char ctmp = buffer.get();
                idRangeOffset[i] = (char)((ctmp>>1)&0xffff);
            }
            /* Can calculate the number of glyph IDs by subtracting
             * "pos" from the length of the cmap
             */
            int pos = (segCount*8+16)/2;
            buffer.position(pos);
            int numGlyphIds = (subtableLength/2 - pos);
            glyphIds = new char[numGlyphIds];
            for (int i=0;i<numGlyphIds;i++) {
                glyphIds[i] = buffer.get();
            }
/*
            System.err.println("segcount="+segCount);
            System.err.println("entrySelector="+entrySelector);
            System.err.println("rangeShift="+rangeShift);
            for (int j=0;j<segCount;j++) {
              System.err.println("j="+j+ " sc="+(int)(startCount[j]&0xffff)+
                                 " ec="+(int)(endCount[j]&0xffff)+
                                 " delta="+idDelta[j] +
                                 " ro="+(int)idRangeOffset[j]);
            }

            //System.err.println("numglyphs="+glyphIds.length);
            for (int i=0;i<numGlyphIds;i++) {
                  System.err.println("gid["+i+"]="+(int)glyphIds[i]);
            }
*/
        }