org.apache.nutch.util
Class TableUtil

java.lang.Object
  extended by org.apache.nutch.util.TableUtil

public class TableUtil
extends Object


Field Summary
static ByteBuffer YES_VAL
           
 
Constructor Summary
TableUtil()
           
 
Method Summary
static String getReversedHost(String reversedUrl)
          Given a reversed url, returns the reversed host E.g "com.foo.bar:http:8983/to/index.html?a=b" -> "com.foo.bar"
static String reverseHost(String hostName)
           
static String reverseUrl(String urlString)
          Reverses a url's domain.
static String reverseUrl(URL url)
          Reverses a url's domain.
static String toString(org.apache.avro.util.Utf8 utf8)
          Convert given Utf8 instance to String
static String unreverseHost(String reversedHostName)
           
static String unreverseUrl(String reversedUrl)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

YES_VAL

public static final ByteBuffer YES_VAL
Constructor Detail

TableUtil

public TableUtil()
Method Detail

reverseUrl

public static String reverseUrl(String urlString)
                         throws MalformedURLException
Reverses a url's domain. This form is better for storing in hbase. Because scans within the same domain are faster.

E.g. "http://bar.foo.com:8983/to/index.html?a=b" becomes "com.foo.bar:8983:http/to/index.html?a=b".

Parameters:
url - url to be reversed
Returns:
Reversed url
Throws:
MalformedURLException

reverseUrl

public static String reverseUrl(URL url)
Reverses a url's domain. This form is better for storing in hbase. Because scans within the same domain are faster.

E.g. "http://bar.foo.com:8983/to/index.html?a=b" becomes "com.foo.bar:http:8983/to/index.html?a=b".

Parameters:
url - url to be reversed
Returns:
Reversed url

unreverseUrl

public static String unreverseUrl(String reversedUrl)

getReversedHost

public static String getReversedHost(String reversedUrl)
Given a reversed url, returns the reversed host E.g "com.foo.bar:http:8983/to/index.html?a=b" -> "com.foo.bar"

Parameters:
reversedUrl - Reversed url
Returns:
Reversed host

reverseHost

public static String reverseHost(String hostName)

unreverseHost

public static String unreverseHost(String reversedHostName)

toString

public static String toString(org.apache.avro.util.Utf8 utf8)
Convert given Utf8 instance to String

Parameters:
utf8 - Utf8 object
Returns:
string-ifed Utf8 object or null if Utf8 instance is null


Copyright © 2012 The Apache Software Foundation