Skip to content

Commit

Permalink
[Java] Avoid bridge methods, PR #169.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjpt777 committed Apr 26, 2019
1 parent 96308ec commit 89d5f13
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions agrona/src/main/java/org/agrona/PrintBufferUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* This is code adapted from <a href="https://netty.io/">the Netty project</a> adopted to support {@link DirectBuffer}.
*/
public final class PrintBufferUtil
public class PrintBufferUtil
{
private static final String NEWLINE = System.lineSeparator();
private static final String EMPTY_STRING = "";
Expand Down Expand Up @@ -164,7 +164,7 @@ public static String byteToHexStringPadded(final int value)
return BYTE2HEX_PAD[value & 0xff];
}

private static final class HexUtil
static final class HexUtil
{
private static final char[] BYTE2CHAR = new char[256];
private static final char[] HEXDUMP_TABLE = new char[256 * 4];
Expand Down Expand Up @@ -244,7 +244,7 @@ static short getUnsignedByte(final DirectBuffer buffer, final int index)
return (short)(buffer.getByte(index) & 0xFF);
}

private static String hexDump(final DirectBuffer buffer, final int fromIndex, final int length)
static String hexDump(final DirectBuffer buffer, final int fromIndex, final int length)
{
if (length < 0)
{
Expand All @@ -269,7 +269,7 @@ HEXDUMP_TABLE, getUnsignedByte(buffer, srcIdx) << 1,
return new String(buf);
}

private static String hexDump(final byte[] array, final int fromIndex, final int length)
static String hexDump(final byte[] array, final int fromIndex, final int length)
{
if (length < 0)
{
Expand All @@ -294,7 +294,7 @@ private static String hexDump(final byte[] array, final int fromIndex, final int
return new String(buf);
}

private static String prettyHexDump(final DirectBuffer buffer, final int offset, final int length)
static String prettyHexDump(final DirectBuffer buffer, final int offset, final int length)
{
if (length == 0)
{
Expand All @@ -319,12 +319,12 @@ private static String prettyHexDump(final DirectBuffer buffer, final int offset,
* @return {@code true} if the requested {@code index} and {@code length} will fit within {@code capacity}.
* {@code false} if this would result in an index out of bounds exception.
*/
public static boolean isOutOfBounds(final int index, final int length, final int capacity)
static boolean isOutOfBounds(final int index, final int length, final int capacity)
{
return (index | length | (index + length) | (capacity - (index + length))) < 0;
}

private static void appendPrettyHexDump(
static void appendPrettyHexDump(
final StringBuilder dump, final DirectBuffer buffer, final int offset, final int length)
{
if (isOutOfBounds(offset, length, buffer.capacity()))
Expand Down Expand Up @@ -401,7 +401,7 @@ private static void appendPrettyHexDump(
.append("+--------+-------------------------------------------------+----------------+");
}

private static void appendHexDumpRowPrefix(final StringBuilder dump, final int row, final int rowStartIndex)
static void appendHexDumpRowPrefix(final StringBuilder dump, final int row, final int rowStartIndex)
{
if (row < HEXDUMP_ROW_PREFIXES.length)
{
Expand All @@ -416,8 +416,4 @@ private static void appendHexDumpRowPrefix(final StringBuilder dump, final int r
}
}
}

private PrintBufferUtil()
{
}
}

0 comments on commit 89d5f13

Please sign in to comment.