Hi folks..

While implementing my algorithm , I am taking vertex value as string..

following is the sample  input format...

[0,"hello world",[[1,1],[3,3]]]
[1,"a",[[0,1],[2,2],[3,1]]]
[2,"b",[[1,2],[4,4]]]
[3,"c",[[0,3],[1,1],[4,4]]]
[4,"d",[[3,4],[2,4]]]

 Suppose above is the input file given..

For this I implemented vertex value class..

But some error is thrown  at some point.

*.*
* Below is the code for Vertex value writable class..*

package org.apache.giraph.examples.utils;
import java.io.*;
import org.apache.hadoop.io.Writable;

public class StringValueWritable implements Writable {

  String s;
  public StringValueWritable()
    {
        s=new String();
        s="";
    }

  public StringValueWritable(String s1)
    { s=new String();
    s=s1;

    }

public String get_string() { return s; }


 @Override
  public void readFields(DataInput in) throws IOException
  {
    s=new String();
 *   s=in.readLine();*
    }
 @Override
  public void write(DataOutput out) throws IOException
 {
      out.writeBytes(s);
 }

@Override
  public String toString()
  {
      return "vertex value is  "+s+"\n";
   }



}
In the highlighted part some error is shown in log files..

Please correct me ,where i went wrong..


 Thanks..

Best Regards

Jyoti

Reply via email to