@Override public String toString() { return "pos: 0x" + Long.toHexString(readPos); } }
private String toString(String key, long bit) { return key+'='+Long.toHexString(bit); }
public String toString() { return Long.toHexString(val1) + Long.toHexString(val2); } }
/** * Creates a valid transaction log file name. * * @param zxid used as a file name suffix (extension) * @return file name */ public static String makeLogName(long zxid) { return FileTxnLog.LOG_FILE_PREFIX + "." + Long.toHexString(zxid); }
private static IllegalArgumentException illegalVarlongException(long value) { throw new IllegalArgumentException("Varlong is too long, most significant bit in the 10th byte is set, " + "converted value: " + Long.toHexString(value)); } }
synchronized void updateProposal(long leader, long zxid, long epoch){ if(LOG.isDebugEnabled()){ LOG.debug("Updating proposal: " + leader + " (newleader), 0x" + Long.toHexString(zxid) + " (newzxid), " + proposedLeader + " (oldleader), 0x" + Long.toHexString(proposedZxid) + " (oldzxid)"); } proposedLeader = leader; proposedZxid = zxid; proposedEpoch = epoch; }
private static void appendHexDumpRowPrefix(StringBuilder dump, int row, int rowStartIndex) { if (row < HEXDUMP_ROWPREFIXES.length) { dump.append(HEXDUMP_ROWPREFIXES[row]); } else { dump.append(NEWLINE); dump.append(Long.toHexString(rowStartIndex & 0xFFFFFFFFL | 0x100000000L)); dump.setCharAt(dump.length() - 9, '|'); dump.append('|'); } } }
/** * Creates a new ephemeral port based on the ID of the specified channel. * Note that we prepend an upper-case character so that it never conflicts with * the addresses created by a user, which are always lower-cased on construction time. */ LocalAddress(Channel channel) { StringBuilder buf = new StringBuilder(16); buf.append("local:E"); buf.append(Long.toHexString(channel.hashCode() & 0xFFFFFFFFL | 0x100000000L)); buf.setCharAt(7, ':'); id = buf.substring(6); strVal = buf.toString(); }
private static String hash(byte[] resource) { CRC_32.reset(); CRC_32.update(resource); return Long.toHexString(CRC_32.getValue()); }
public void checkPos(long expectedOffset, String error) throws IOException { if (getPos() != expectedOffset) { throw new IOException(error + ", expected offset: 0x" + Long.toHexString(expectedOffset) + ", actual: 0x" + Long.toHexString(getPos())); } }
private void throwException(String error, int expected, int actual) throws IOException { throw new IOException(error + ", expected: 0x" + Integer.toHexString(expected) + ", actual: 0x" + Integer.toHexString(actual) + ", offset: 0x" + Long.toHexString(getPos())); }
protected void die(String message) throws IOException { throw new IOException("Decode error: " + message + ", position: 0x" + Long.toHexString(is.getPos())); } }
private static void appendHexDumpRowPrefix(StringBuilder dump, int row, int rowStartIndex) { if (row < HEXDUMP_ROWPREFIXES.length) { dump.append(HEXDUMP_ROWPREFIXES[row]); } else { dump.append(NEWLINE); dump.append(Long.toHexString(rowStartIndex & 0xFFFFFFFFL | 0x100000000L)); dump.setCharAt(dump.length() - 9, '|'); dump.append('|'); } } }
public static String getVersionFromFilename(String filename) { int i = filename.lastIndexOf('.'); if(i < 0 || i >= filename.length()) return null; String hexVersion = filename.substring(i + 1); try { long version = Long.parseLong(hexVersion, 16); return Long.toHexString(version); } catch (NumberFormatException e) { return null; } }
/** * Creates a new ephemeral port based on the ID of the specified channel. * Note that we prepend an upper-case character so that it never conflicts with * the addresses created by a user, which are always lower-cased on construction time. */ LocalAddress(Channel channel) { StringBuilder buf = new StringBuilder(16); buf.append("local:E"); buf.append(Long.toHexString(channel.hashCode() & 0xFFFFFFFFL | 0x100000000L)); buf.setCharAt(7, ':'); id = buf.substring(6); strVal = buf.toString(); }
File textFile = new File("/path/to/file.txt"); File binaryFile = new File("/path/to/file.bin"); String boundary = Long.toHexString(System.currentTimeMillis()); // Just generate some unique random value. String CRLF = "\r\n"; // Line separator required by multipart/form-data. URLConnection connection = new URL(url).openConnection();
public boolean trackSession(long sessionId, int sessionTimeout) { boolean tracked = globalSessionTracker.trackSession(sessionId, sessionTimeout); if (localSessionsEnabled && tracked) { // Only do extra logging so we know what kind of session this is // if we're supporting both kinds of sessions LOG.info("Tracking global session 0x" + Long.toHexString(sessionId)); } return tracked; }
protected void killSession(long sessionId, long zxid) { zkDb.killSession(sessionId, zxid); if (LOG.isTraceEnabled()) { ZooTrace.logTraceMessage(LOG, ZooTrace.SESSION_TRACE_MASK, "ZooKeeperServer --- killSession: 0x" + Long.toHexString(sessionId)); } if (sessionTracker != null) { sessionTracker.removeSession(sessionId); } }
@Test public void parseNumberAsHex() { String aByte = "0x" + Integer.toHexString(Byte.valueOf(Byte.MAX_VALUE).intValue()); String aShort = "0x" + Integer.toHexString(Short.valueOf(Short.MAX_VALUE).intValue()); String anInteger = "0x" + Integer.toHexString(Integer.MAX_VALUE); String aLong = "0x" + Long.toHexString(Long.MAX_VALUE); String aReallyBigInt = "FEBD4E677898DFEBFFEE44"; assertByteEquals(aByte); assertShortEquals(aShort); assertIntegerEquals(anInteger); assertLongEquals(aLong); assertEquals("BigInteger did not parse", new BigInteger(aReallyBigInt, 16), NumberUtils.parseNumber("0x" + aReallyBigInt, BigInteger.class)); }
@BeforeClass public void setUp() throws Exception { tempFile = new TempFile(); Random random = new Random(); Iterator<String> iterator = Stream.generate(() -> Long.toHexString(random.nextLong())).limit(POSITION_COUNT).iterator(); writeOrcFileColumnHive( tempFile.getFile(), ORC_12, createOrcRecordWriter(tempFile.getFile(), ORC_12, ZLIB, javaStringObjectInspector), VARCHAR, iterator); }