I'm not sure of the problem, but I can suggest an alternative. Use the
writeUTF and readUTF methods to write and read strings.


On Thu, Apr 17, 2014 at 4:02 PM, Jyoti Yadav <[email protected]>wrote:

> 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
>



-- 
*Sundara Raghavan Sankaran*

 [email protected]

+91 99520 06708 (IND)

 sundar.crayon

-- 

------------------------------

<http://crayondata.com/?utm_source=emailsig>      
<https://www.facebook.com/crayondata><https://twitter.com/CrayonBigData><http://www.linkedin.com/company/crayon-data><https://plus.google.com/+Crayondata1><http://www.youtube.com/user/crayonbigdata>
www.crayondata.com <http://crayondata.com/?utm_source=emailsig>

<http://bigdata-madesimple.com/?utm_source=emailsig>
www.bigdata-madesimple.com<http://bigdata-madesimple.com/?utm_source=emailsig>
------------------------------

 
Finalist<http://www.code-n.org/fileadmin/user_upload/pdf/131210_List_Top_50_EN.pdf>
 at 
the Code_N 2014 Contest <http://www.code-n.org/cebit/award/> at 
CEBIT<http://www.cebit.com/>, 
Hanover - the only big data company from Asia. 


This email and its contents are confidential, and meant only for you. Views 
or opinions, presented in this email, are solely of the author and may not 
necessarily represent Crayon Data.

Reply via email to