/** * Reads a variable-length unsigned LEB128 value. Does not attempt to * verify that the value is valid. * * @throws EOFException if we run off the end of the file */ int readUnsignedLeb128() throws IOException { int result = 0; byte val; do { val = readByte(); result = (result << 7) | (val & 0x7f); } while (val < 0); return result; }
/** * Reads a variable-length unsigned LEB128 value. Does not attempt to * verify that the value is valid. * * @throws EOFException if we run off the end of the file */ int readUnsignedLeb128() throws IOException { int result = 0; byte val; do { val = readByte(); result = (result << 7) | (val & 0x7f); } while (val < 0); return result; }
/** * Reads a variable-length unsigned LEB128 value. Does not attempt to * verify that the value is valid. * * @throws IOException if we run off the end of the file */ int readUnsignedLeb128() throws IOException { int result = 0; byte val; do { val = readByte(); result = (result << 7) | (val & 0x7f); } while (val < 0); return result; }
/** * Reads a variable-length unsigned LEB128 value. Does not attempt to * verify that the value is valid. * * @throws IOException if we run off the end of the file */ int readUnsignedLeb128() throws IOException { int result = 0; byte val; do { val = readByte(); result = (result << 7) | (val & 0x7f); } while (val < 0); return result; }
/** * Reads a variable-length unsigned LEB128 value. Does not attempt to * verify that the value is valid. * * @throws java.io.EOFException if we run off the end of the file */ int readUnsignedLeb128() throws IOException { int result = 0; byte val; do { val = readByte(); result = (result << 7) | (val & 0x7f); } while (val < 0); return result; }
/** * Reads a UTF-8 string. * * We don't know how long the UTF-8 string is, so we have to read one * byte at a time. We could make an educated guess based on the * utf16_size and seek back if we get it wrong, but seeking backward * may cause the underlying implementation to reload I/O buffers. */ String readString() throws IOException { int utf16len = readUnsignedLeb128(); byte inBuf[] = new byte[utf16len * 3]; // worst case int idx; for (idx = 0; idx < inBuf.length; idx++) { byte val = readByte(); if (val == 0) break; inBuf[idx] = val; } return new String(inBuf, 0, idx, "UTF-8"); }
/** * Reads a UTF-8 string. * * We don't know how long the UTF-8 string is, so we have to read one * byte at a time. We could make an educated guess based on the * utf16_size and seek back if we get it wrong, but seeking backward * may cause the underlying implementation to reload I/O buffers. */ String readString() throws IOException { int utf16len = readUnsignedLeb128(); byte inBuf[] = new byte[utf16len * 3]; // worst case int idx; for (idx = 0; idx < inBuf.length; idx++) { byte val = readByte(); if (val == 0) break; inBuf[idx] = val; } return new String(inBuf, 0, idx, "UTF-8"); }
/** * Reads a UTF-8 string. * * We don't know how long the UTF-8 string is, so we have to read one * byte at a time. We could make an educated guess based on the * utf16_size and seek back if we get it wrong, but seeking backward * may cause the underlying implementation to reload I/O buffers. */ String readString() throws IOException { int utf16len = readUnsignedLeb128(); byte inBuf[] = new byte[utf16len * 3]; // worst case int idx; for (idx = 0; idx < inBuf.length; idx++) { byte val = readByte(); if (val == 0) { break; } inBuf[idx] = val; } return new String(inBuf, 0, idx, "UTF-8"); }
/** * Reads a UTF-8 string. * * We don't know how long the UTF-8 string is, so we have to read one * byte at a time. We could make an educated guess based on the * utf16_size and seek back if we get it wrong, but seeking backward * may cause the underlying implementation to reload I/O buffers. */ String readString() throws IOException { int utf16len = readUnsignedLeb128(); byte inBuf[] = new byte[utf16len * 3]; // worst case int idx; for (idx = 0; idx < inBuf.length; idx++) { byte val = readByte(); if (val == 0) break; inBuf[idx] = val; } return new String(inBuf, 0, idx, "UTF-8"); }
/** * Reads a UTF-8 string. * * We don't know how long the UTF-8 string is, so we have to read one * byte at a time. We could make an educated guess based on the * utf16_size and seek back if we get it wrong, but seeking backward * may cause the underlying implementation to reload I/O buffers. */ String readString() throws IOException { int utf16len = readUnsignedLeb128(); byte inBuf[] = new byte[utf16len * 3]; // worst case int idx; for (idx = 0; idx < inBuf.length; idx++) { byte val = readByte(); if (val == 0) break; inBuf[idx] = val; } return new String(inBuf, 0, idx, "UTF-8"); }