How to convert a String object to IntWritable Object in Hadoop

I want to convert an object Stringto an IntWritableObject in Hadoop. any process is available for conversion.

thanks

+4
source share
1 answer
IntWritable value = new IntWritable(Integer.parseInt(someString))

... and deal with the possibility of what parseIntmight throw away NumberFormatException.


Someone asked:

How to overcome this NumberFormatException

You will catch him and, of course, handle it! Java exceptions and exception handling are described in the Oracle Java tutorials here .

+10
source

All Articles