28 bytes (allows immediate JVM inlining: < 35 bytes) LOG4J2-1096
483856
private static void handleRemainingCharIfAny(final String messagePattern, final int len,
            final StringBuilder buffer, final int escapeCounter, final int i) {
        if (i == len - 1) {
            final char curChar = messagePattern.charAt(i);
            handleLastChar(buffer, escapeCounter, curChar);
        }
    }
42199
@Override
  void writeJournal(OutputStream os, 
                    byte[] buffer, int offset,
                    BlobOutputStream blob)
    throws IOException
  {
    if (blob == null) {
      BitsUtil.writeInt16(os, 0);
      return;
    }

    if (blob.isLargeBlob()) {
      blob.flushBlob();
      
      BitsUtil.writeInt16(os, LARGE_BLOB_MASK | 4);
      BitsUtil.writeInt(os, blob.getBlobId());
      return;
    }
    
    int len = blob.getSize();
    
    if (len >= 32 * 1024) {
      throw new IllegalStateException("TOO_BIG: " + len);
    }
    
    BitsUtil.writeInt16(os, len);
    
    blob.writeToStream(os);
  }
378188
@Override
    public int estimateUnassembledValueSize(int index) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            JmfTr.entry(this, tc, "estimateUnassembledValueSize", index);

        int size = 0;

        // We are only interested in 'real' fields, not boxed variants etc
        if (index < cacheSize) {
            checkIndex(index);

            synchronized (getMessageLockArtefact()) {

                // We can only figure out the size if we have a field definition (which presumably should
                // be the case). Have to specifiy false on getFieldDef, otherwise it will return null
                // if the message hasn't been assembled.
                JSField field = getFieldDef(index, false);
                if (field != null) {

                    Object val = cache[index];

                    // If the value is in the cache and isn't something with 0 size
                    if ((val != null)
                        && (val != nullIndicator)
                        && (val != JSVaryingListImpl.EMPTY_UNBOXED_VARYINGLIST)
                        && (val != JSFixedListImpl.EMPTY_FIXEDLIST)) {
                        size = (field.estimateSizeOfUnassembledValue(val, indirect));
                    }

                    // If not, estimate it from the information in the contents, if we have any
                    else if (contents != null) {
                        try {
                            size = (field.estimateSizeOfUnassembledValue(contents, getAbsoluteOffset(index), indirect));
                        } catch (JMFUninitializedAccessException e) {
                            // No FFDC code needed
                            // We don't want to throw an exception or even FFDC it (as we don't
                            // know anything useful to FFDC). We'll just let it default to 0.
                        }
                    }
                }
            }
        }

        // If we have no FieldDef, a nullIndicator or no contents, then we will just return 0;

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            JmfTr.exit(this, tc, "estimateUnassembledValueSize", size);
        return size;
    }
303870
public void dump() throws InvocationException {
		if (_updated) {
			synchronized (_lock) {
				if (!_updated)
					return;

				List<LogMessage> messages = _cache;
				_cache = new ArrayList<LogMessage>();

				save(messages);

				_updated = false;
				_lastDumpTime = System.currentTimeMillis();
			}
		}
	}
287562
@Override
  public int encodedLength(CharSequence in) {
    final Cache cache = CACHE.get();
    int estimated = (int) (in.length() * cache.encoder.maxBytesPerChar());
    if (cache.lastOutput == null || cache.lastOutput.capacity() < estimated) {
      cache.lastOutput = ByteBuffer.allocate(Math.max(128, estimated));
    }
    cache.lastOutput.clear();
    cache.lastInput = in;
    CharBuffer wrap = (in instanceof CharBuffer) ?
                          (CharBuffer) in : CharBuffer.wrap(in);
    CoderResult result = cache.encoder.encode(wrap, cache.lastOutput, true);
    if (result.isError()) {
      try {
        result.throwException();
      } catch (CharacterCodingException e) {
        throw new IllegalArgumentException("bad character encoding", e);
      }
    }
    return cache.lastOutput.remaining();
  }
440370
String constructLogMsg() {
    final StringBuilder msg = new StringBuilder();

    for (final Map.Entry<String, List<StackTraceElement>> e : paramToStackTrace.build().entries()) {
      msg.append("Parameter ").append(e.getKey()).append(" accessed at \n");
      msg.append(FluentIterable.from(e.getValue())
          // but exclude code in Parameters itself
          .filter(not(IS_THIS_CLASS))
          .filter(not(IS_PARAMETERS_ITSELF))
          .filter(not(IS_THREAD_CLASS))
          .join(StringUtils.unixNewlineJoiner()));
      msg.append("\n\n");
    }
    return msg.toString();
  }
165550
private static int logger(int level, String message, Throwable throwable) {

        if (QuickUtils.shouldShowLogs()) {
            switch (level) {

                case QuickUtils.DEBUG:
                    return android.util.Log.d(QuickUtils.TAG, message, throwable);
                case QuickUtils.VERBOSE:
                    return android.util.Log.v(QuickUtils.TAG, message, throwable);
                case QuickUtils.INFO:
                    return android.util.Log.i(QuickUtils.TAG, message, throwable);
                case QuickUtils.WARN:
                    return android.util.Log.w(QuickUtils.TAG, message, throwable);
                case QuickUtils.ERROR:
                    return android.util.Log.e(QuickUtils.TAG, message, throwable);
                default:
                    break;
            }
        }

        return -1;
    }
928555
public void init ()
    {
        try {
            if (!Boolean.getBoolean("com.samskivert.util.JDK14Logger.noFormatter")) {
                OneLineLogFormatter.configureDefaultHandler();
            }
            boolean reportedUTF8Missing = false;
            for (Handler handler : java.util.logging.Logger.getLogger("").getHandlers()) {
                try {
                    handler.setEncoding("UTF-8");
                } catch (UnsupportedEncodingException e) {
                    // JVMs are required to support UTF-8 so this shouldn't happen, but if it does,
                    // tell somebody that things are really fucked
                    if (!reportedUTF8Missing) {
                        reportedUTF8Missing = true;
                        System.err.println("Unable to find UTF-8 encoding. " +
                                           "This JVM ain't right: " + e.getMessage());
                    }
                }
            }
        } catch (SecurityException se) {
            // running in sandbox; no custom logging; no problem!
        }
    }
196109
private static long SBOG_LPSti64(Int512 t, int i) {
        return (StreebogTables.sbob_sl64[0][t.getByte(i) & 0xFF] ^
                StreebogTables.sbob_sl64[1][t.getByte(i + 8) & 0xFF] ^
                StreebogTables.sbob_sl64[2][t.getByte(i + 16) & 0xFF] ^
                StreebogTables.sbob_sl64[3][t.getByte(i + 24) & 0xFF] ^
                StreebogTables.sbob_sl64[4][t.getByte(i + 32) & 0xFF] ^
                StreebogTables.sbob_sl64[5][t.getByte(i + 40) & 0xFF] ^
                StreebogTables.sbob_sl64[6][t.getByte(i + 48) & 0xFF] ^
                StreebogTables.sbob_sl64[7][t.getByte(i + 56) & 0xFF]);
    }
409979
private static int simulateEncodeTree(Cookie cookie, int[] llLengths, int[] dLengths,
                                          boolean use16, boolean use17, boolean use18) {
        int hLit = 29;
        int hDist = 29;

        while (hLit > 0 && llLengths[256 + hLit] == 0) {
            hLit--;
        }
        while (hDist > 0 && dLengths[hDist] == 0) {
            hDist--;
        }

        int lldTotal = hLit + 258 + hDist;
        int[] lldLengths = cookie.i320b;
        System.arraycopy(llLengths, 0, lldLengths, 0, 257 + hLit);
        System.arraycopy(dLengths, 0, lldLengths, 257 + hLit, hDist + 1);

        int[] rle = cookie.i320a;
        int rleSize = 0;

        for (int i = 0; i < lldTotal; i++) {
            int count = 1;
            int symbol = lldLengths[i];
            if (use16 || (symbol == 0 && (use17 || use18))) {
                for (int j = i + 1; j < lldTotal && symbol == lldLengths[j]; j++) {
                    count++;
                }
            }
            i += count - 1;

            if (symbol == 0 && count > 2) {
                if (use18) {
                    while (count > 10) {
                        rle[rleSize++] = 18;
                        count -= count > 138 ? 138 : count;
                    }
                }
                if (use17) {
                    while (count > 2) {
                        rle[rleSize++] = 17;
                        count -= count > 10 ? 10 : count;
                    }
                }
            }

            if (use16 && count > 3) {
                count--;
                rle[rleSize++] = symbol;
                while (count > 2) {
                    rle[rleSize++] = 16;
                    count -= count > 6 ? 6 : count;
                }
            }

            while (count != 0) {
                rle[rleSize++] = symbol;
                count--;
            }
        }

        int[] clCounts = cookie.i19a;
        System.arraycopy(Cookie.intZeroes, 0, clCounts, 0, 19);
        for (int i = 0; i < rleSize; ++i) {
            clCounts[rle[i]]++;
        }

        int[] clCl = cookie.i19b;
        System.arraycopy(Cookie.intZeroes, 0, clCl, 0, 19);
        Katajainen.lengthLimitedCodeLengths(cookie, clCounts, 7, clCl);
        clCl[16] += 2;
        clCl[17] += 3;
        clCl[18] += 7;

        int[] order = Util.ORDER;
        int hcLen = 15;
        while (hcLen > 0 && clCounts[order[hcLen + 3]] == 0) {
            hcLen--;
        }

        int result = 5 + 5 + 4 + (hcLen + 4) * 3;
        for (int i = 0; i < 19; i++) {
            result += clCl[i] * clCounts[i];
        }

        return result;
    }
1006195
@Override
    protected int readBytesWireFormat ( byte[] buffer, int bufferIndex ) throws SMBProtocolDecodingException {
        int start = bufferIndex;
        int structureSize = SMBUtil.readInt2(buffer, bufferIndex);

        if ( structureSize != 89 ) {
            throw new SMBProtocolDecodingException("Structure size is not 89");
        }

        this.oplockLevel = buffer[ bufferIndex + 2 ];
        this.openFlags = buffer[ bufferIndex + 3 ];
        bufferIndex += 4;

        this.createAction = SMBUtil.readInt4(buffer, bufferIndex);
        bufferIndex += 4;

        this.creationTime = SMBUtil.readTime(buffer, bufferIndex);
        bufferIndex += 8;
        this.lastAccessTime = SMBUtil.readTime(buffer, bufferIndex);
        bufferIndex += 8;
        this.lastWriteTime = SMBUtil.readTime(buffer, bufferIndex);
        bufferIndex += 8;
        this.changeTime = SMBUtil.readTime(buffer, bufferIndex);
        bufferIndex += 8;

        this.allocationSize = SMBUtil.readInt8(buffer, bufferIndex);
        bufferIndex += 8;
        this.endOfFile = SMBUtil.readInt8(buffer, bufferIndex);
        bufferIndex += 8;

        this.fileAttributes = SMBUtil.readInt4(buffer, bufferIndex);
        bufferIndex += 4;
        bufferIndex += 4; // Reserved2

        System.arraycopy(buffer, bufferIndex, this.fileId, 0, 16);
        bufferIndex += 16;

        int createContextOffset = SMBUtil.readInt4(buffer, bufferIndex);
        bufferIndex += 4;
        int createContextLength = SMBUtil.readInt4(buffer, bufferIndex);
        bufferIndex += 4;

        if ( createContextOffset > 0 && createContextLength > 0 ) {
            List<CreateContextResponse> contexts = new LinkedList<>();
            int createContextStart = getHeaderStart() + createContextOffset;
            int next = 0;
            do {
                int cci = createContextStart;
                next = SMBUtil.readInt4(buffer, cci);
                cci += 4;

                int nameOffset = SMBUtil.readInt2(buffer, cci);
                int nameLength = SMBUtil.readInt2(buffer, cci + 2);
                cci += 4;

                int dataOffset = SMBUtil.readInt2(buffer, cci + 2);
                cci += 4;
                int dataLength = SMBUtil.readInt4(buffer, cci);
                cci += 4;

                byte[] nameBytes = new byte[nameLength];
                System.arraycopy(buffer, createContextStart + nameOffset, nameBytes, 0, nameBytes.length);
                cci = Math.max(cci, createContextStart + nameOffset + nameLength);

                CreateContextResponse cc = createContext(nameBytes);
                if ( cc != null ) {
                    cc.decode(buffer, createContextStart + dataOffset, dataLength);
                    contexts.add(cc);
                }

                cci = Math.max(cci, createContextStart + dataOffset + dataLength);

                if ( next > 0 ) {
                    createContextStart += next;
                }
                bufferIndex = Math.max(bufferIndex, cci);
            }
            while ( next > 0 );
            this.createContexts = contexts.toArray(new CreateContextResponse[0]);
        }

        if ( log.isDebugEnabled() ) {
            log.debug("Opened " + this.fileName + ": " + Hexdump.toHexString(this.fileId));
        }

        return bufferIndex - start;
    }
569560
static long checkPreambleSize(final Memory mem) {
    final long cap = mem.getCapacity();
    if (cap < 8) { throwNotBigEnough(cap, 8); }
    final long pre0 = mem.getLong(0);
    final int preLongs = (int) (pre0 & 0X3FL); //lower 6 bits
    final int required = Math.max(preLongs << 3, 8);
    if (cap < required) { throwNotBigEnough(cap, required); }
    return pre0;
  }
939055
function writeToLog(chunk, encoding, colorFunction) {
        // We stopped logging in a previous call to write: return now
        if (_logBytesWritten > LOG_SIZE_LIMIT) { return; }

        var chunkLength,
            logMsg;

        if (!Buffer.isBuffer(chunk)) {
            chunk = String(chunk);
            if (colorFunction) {
                chunk = colorFunction(chunk);
            }
            chunkLength = Buffer.byteLength(chunk, encoding);
        } else {
            chunkLength = chunk.length;
        }

        // Calculate the new log file size
        _logBytesWritten += chunkLength;

        // Limit not yet reached: write to log file
        if (_logBytesWritten > LOG_SIZE_LIMIT) {
            logMsg = "The log file size limit of " + LOG_SIZE_LIMIT + " bytes was reached." +
                " No further output will be written to this file.";
        } else {
            logMsg = chunk;
        }

        _logFilePaths.forEach(function (path) {
            try {
                fs.appendFileSync(path, logMsg, { encoding: encoding });
            } catch (e) {
                // do nothing
            }
        });
    }
698084
public void toRfc5424SyslogMessage(Writer out) throws IOException {

        int pri = facility.numericalCode() * 8 + severity.numericalCode();

        out.write('<');
        out.write(String.valueOf(pri));
        out.write('>');
        out.write('1'); // version
        out.write(SP);
        out.write(rfc3339DateFormat.format(timestamp == null ? new Date() : new Date(timestamp))); // message time
        out.write(SP);
        out.write(hostname == null ? localhostNameReference.get() : hostname); // emitting server hostname
        out.write(SP);
        writeNillableValue(appName, out); // appname
        out.write(SP);
        writeNillableValue(procId, out); // PID
        out.write(SP);
        writeNillableValue(msgId, out);// Message ID
        out.write(SP);
        writeStructuredDataOrNillableValue(sdElements, out);
        if (msg != null) {
            out.write(SP);
            msg.writeTo(out);
        }
    }
796036
private static long hexdump(InputStream is, PrintWriter pw) throws Exception
   {
      byte[] buffer = new byte[BUFFER_SIZE];
      long byteCount = 0;

      char c;
      int loop;
      int count;
      StringBuilder sb = new StringBuilder();

      while (true)
      {
         count = is.read(buffer);
         if (count == -1)
         {
            break;
         }

         byteCount += count;

         sb.setLength(0);

         for (loop = 0; loop < count; loop++)
         {
            sb.append(" ");
            sb.append(HEX_DIGITS[(buffer[loop] & 0xF0) >> 4]);
            sb.append(HEX_DIGITS[buffer[loop] & 0x0F]);
         }

         while (loop < BUFFER_SIZE)
         {
            sb.append("   ");
            ++loop;
         }

         sb.append("   ");

         for (loop = 0; loop < count; loop++)
         {
            c = (char) buffer[loop];
            if (c > 200 || c < 27)
            {
               c = ' ';
            }

            sb.append(c);
         }

         pw.println(sb.toString());
      }

      return (byteCount);
   }
317538
public final void synpred244_Java_fragment() throws RecognitionException {
		// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1211:8: ( '(' primitiveType ')' unaryExpression )
		// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1211:8: '(' primitiveType ')' unaryExpression
		{
		match(input,36,FOLLOW_36_in_synpred244_Java5610); if (state.failed) return;
		pushFollow(FOLLOW_primitiveType_in_synpred244_Java5612);
		primitiveType();
		state._fsp--;
		if (state.failed) return;
		match(input,37,FOLLOW_37_in_synpred244_Java5614); if (state.failed) return;
		pushFollow(FOLLOW_unaryExpression_in_synpred244_Java5616);
		unaryExpression();
		state._fsp--;
		if (state.failed) return;
		}

	}
514934
private int bufferCrypt(ByteBuffer input, ByteBuffer output,
            boolean isUpdate) throws ShortBufferException,
            IllegalBlockSizeException, BadPaddingException {
        if ((input == null) || (output == null)) {
            throw new NullPointerException
                ("Input and output buffers must not be null");
        }
        int inPos = input.position();
        int inLimit = input.limit();
        int inLen = inLimit - inPos;
        if (isUpdate && (inLen == 0)) {
            return 0;
        }
        int outLenNeeded = engineGetOutputSize(inLen);
        if (output.remaining() < outLenNeeded) {
            throw new ShortBufferException("Need at least " + outLenNeeded
                + " bytes of space in output buffer");
        }

        boolean a1 = input.hasArray();
        boolean a2 = output.hasArray();

        if (a1 && a2) {
            byte[] inArray = input.array();
            int inOfs = input.arrayOffset() + inPos;
            byte[] outArray = output.array();
            int outPos = output.position();
            int outOfs = output.arrayOffset() + outPos;
            int n;
            if (isUpdate) {
                n = engineUpdate(inArray, inOfs, inLen, outArray, outOfs);
            } else {
                n = engineDoFinal(inArray, inOfs, inLen, outArray, outOfs);
            }
            input.position(inLimit);
            output.position(outPos + n);
            return n;
        } else if (!a1 && a2) {
            int outPos = output.position();
            byte[] outArray = output.array();
            int outOfs = output.arrayOffset() + outPos;
            byte[] inArray = new byte[getTempArraySize(inLen)];
            int total = 0;
            do {
                int chunk = Math.min(inLen, inArray.length);
                if (chunk > 0) {
                    input.get(inArray, 0, chunk);
                }
                int n;
                if (isUpdate || (inLen != chunk)) {
                    n = engineUpdate(inArray, 0, chunk, outArray, outOfs);
                } else {
                    n = engineDoFinal(inArray, 0, chunk, outArray, outOfs);
                }
                total += n;
                outOfs += n;
                inLen -= chunk;
            } while (inLen > 0);
            output.position(outPos + total);
            return total;
        } else { // output is not backed by an accessible byte[]
            byte[] inArray;
            int inOfs;
            if (a1) {
                inArray = input.array();
                inOfs = input.arrayOffset() + inPos;
            } else {
                inArray = new byte[getTempArraySize(inLen)];
                inOfs = 0;
            }
            byte[] outArray = new byte[getTempArraySize(outLenNeeded)];
            int outSize = outArray.length;
            int total = 0;
            boolean resized = false;
            do {
                int chunk =
                    Math.min(inLen, (outSize == 0? inArray.length : outSize));
                if (!a1 && !resized && chunk > 0) {
                    input.get(inArray, 0, chunk);
                    inOfs = 0;
                }
                try {
                    int n;
                    if (isUpdate || (inLen != chunk)) {
                        n = engineUpdate(inArray, inOfs, chunk, outArray, 0);
                    } else {
                        n = engineDoFinal(inArray, inOfs, chunk, outArray, 0);
                    }
                    resized = false;
                    inOfs += chunk;
                    inLen -= chunk;
                    if (n > 0) {
                        output.put(outArray, 0, n);
                        total += n;
                    }
                } catch (ShortBufferException e) {
                    if (resized) {
                        // we just resized the output buffer, but it still
                        // did not work. Bug in the provider, abort
                        throw (ProviderException)new ProviderException
                            ("Could not determine buffer size").initCause(e);
                    }
                    // output buffer is too small, realloc and try again
                    resized = true;
                    outSize = engineGetOutputSize(chunk);
                    outArray = new byte[outSize];
                }
            } while (inLen > 0);
            if (a1) {
                input.position(inLimit);
            }
            return total;
        }
    }