Codota Logo
StringUtils.hexStringToByte
Code IndexAdd Codota to your IDE (free)

How to use
hexStringToByte
method
in
org.apache.hadoop.util.StringUtils

Best Java code snippets using org.apache.hadoop.util.StringUtils.hexStringToByte (Showing top 13 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: org.apache.hadoop/hadoop-hdfs-httpfs

@Override
public byte[] getBytes() {
 return StringUtils.hexStringToByte((String) json.get(CHECKSUM_BYTES_JSON));
}
origin: org.apache.hadoop/hadoop-common-test

/**
 * Convert a string of lines that look like:
 *   "68 72 70 63 02 00 00 00  82 00 1d 6f 72 67 2e 61 hrpc.... ...org.a"
 * .. into an array of bytes.
 */
private static byte[] hexDumpToBytes(String hexdump) {
 final int LAST_HEX_COL = 3 * 16;
 
 StringBuilder hexString = new StringBuilder();
 
 for (String line : hexdump.toUpperCase().split("\n")) {
  hexString.append(line.substring(0, LAST_HEX_COL).replace(" ", ""));
 }
 return StringUtils.hexStringToByte(hexString.toString());
}

origin: com.backtype/dfs-datastores

public static Object getObject(JobConf conf, String key) {
  String s = conf.get(key);
  if(s==null) return null;
  byte[] val = StringUtils.hexStringToByte(s);
  return deserialize(val);
}
origin: cerndb/hdfs-metadata

/**
 * Returns a disk id (0-based) index from the Hdfs VolumeId object. There is
 * currently no public API to get at the volume id. We'll have to get it by
 * accessing the internals.
 */
public static int getDiskId(VolumeId hdfsVolumeId){
  // Initialize the diskId as -1 to indicate it is unknown
  int diskId = -1;
  if (hdfsVolumeId != null) {
    String volumeIdString = hdfsVolumeId.toString();
    byte[] volumeIdBytes = StringUtils.hexStringToByte(volumeIdString);
    if (volumeIdBytes != null && volumeIdBytes.length == 4) {
      diskId = Utils.toInt(volumeIdBytes);
    }else if (volumeIdBytes.length == 1) {
      diskId = (int) volumeIdBytes[0];  // support hadoop-2.0.2
    }
  }
  return diskId;
}
origin: opendedup/sdfs

pos = Long.parseLong(st[0]);
int cap = Integer.parseInt(st[1]);
byte [] hash = StringUtils.hexStringToByte(st[2]);
byte [] b = new byte [cap];
r.seek(pos);
origin: com.github.jiayuhan-it/hadoop-common

/**
 * Convert a string of lines that look like:
 *   "68 72 70 63 02 00 00 00  82 00 1d 6f 72 67 2e 61 hrpc.... ...org.a"
 * .. into an array of bytes.
 */
private static byte[] hexDumpToBytes(String hexdump) {
 final int LAST_HEX_COL = 3 * 16;
 
 StringBuilder hexString = new StringBuilder();
 
 for (String line : StringUtils.toUpperCase(hexdump).split("\n")) {
  hexString.append(line.substring(0, LAST_HEX_COL).replace(" ", ""));
 }
 return StringUtils.hexStringToByte(hexString.toString());
}

origin: ch.cern.hadoop/hadoop-common

/**
 * Convert a string of lines that look like:
 *   "68 72 70 63 02 00 00 00  82 00 1d 6f 72 67 2e 61 hrpc.... ...org.a"
 * .. into an array of bytes.
 */
private static byte[] hexDumpToBytes(String hexdump) {
 final int LAST_HEX_COL = 3 * 16;
 
 StringBuilder hexString = new StringBuilder();
 
 for (String line : StringUtils.toUpperCase(hexdump).split("\n")) {
  hexString.append(line.substring(0, LAST_HEX_COL).replace(" ", ""));
 }
 return StringUtils.hexStringToByte(hexString.toString());
}

origin: ch.cern.hadoop/hadoop-hdfs

final String algorithm = (String)m.get("algorithm");
final int length = ((Number) m.get("length")).intValue();
final byte[] bytes = StringUtils.hexStringToByte((String)m.get("bytes"));
origin: org.apache.hadoop/hadoop-hdfs-client

final String algorithm = (String)m.get("algorithm");
final int length = ((Number) m.get("length")).intValue();
final byte[] bytes = StringUtils.hexStringToByte((String) m.get("bytes"));
origin: io.prestosql.hadoop/hadoop-apache

final String algorithm = (String)m.get("algorithm");
final int length = ((Number) m.get("length")).intValue();
final byte[] bytes = StringUtils.hexStringToByte((String)m.get("bytes"));
origin: org.apache.hadoop/hadoop-hdfs-test

byte[] imageBytes = StringUtils.hexStringToByte(
 "fffffffee17c0d2700000000");
FileOutputStream fos = new FileOutputStream(imageFile);
origin: ch.cern.hadoop/hadoop-hdfs

/**
 * Test case for an empty edit log from a prior version of Hadoop.
 */
@Test
public void testPreTxIdEditLogNoEdits() throws Exception {
 FSNamesystem namesys = Mockito.mock(FSNamesystem.class);
 namesys.dir = Mockito.mock(FSDirectory.class);
 long numEdits = testLoad(
   StringUtils.hexStringToByte("ffffffed"), // just version number
   namesys);
 assertEquals(0, numEdits);
}

origin: ch.cern.hadoop/hadoop-hdfs

byte[] imageBytes = StringUtils.hexStringToByte(
 "fffffffee17c0d2700000000");
FileOutputStream fos = new FileOutputStream(imageFile);
org.apache.hadoop.utilStringUtilshexStringToByte

Javadoc

Given a hexstring this will return the byte array corresponding to the string

Popular methods of StringUtils

  • stringifyException
    Make a string representation of the exception.
  • join
    Concatenates strings, using a separator.
  • split
  • arrayToString
  • toLowerCase
    Converts all of the characters in this String to lower case with Locale.ENGLISH.
  • escapeString
  • startupShutdownMessage
    Print a log message for starting up and shutting down
  • getStrings
    Returns an arraylist of strings.
  • toUpperCase
    Converts all of the characters in this String to upper case with Locale.ENGLISH.
  • byteToHexString
    Given an array of bytes it will convert the bytes to a hex string representation of the bytes
  • formatTime
    Given the time in long milliseconds, returns a String in the format Xhrs, Ymins, Z sec.
  • unEscapeString
  • formatTime,
  • unEscapeString,
  • getStringCollection,
  • byteDesc,
  • formatPercent,
  • getTrimmedStrings,
  • equalsIgnoreCase,
  • format,
  • formatTimeDiff,
  • getTrimmedStringCollection

Popular in Java

  • Start an intent from android
  • getContentResolver (Context)
  • setContentView (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate(i
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • JFrame (javax.swing)
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now