This project has retired. For details please refer to its Attic page.
TupleWritable (Apache Crunch 0.3.0-incubating API)

org.apache.crunch.types.writable
Class TupleWritable

java.lang.Object
  extended by org.apache.crunch.types.writable.TupleWritable
All Implemented Interfaces:
Comparable<TupleWritable>, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable<TupleWritable>

public class TupleWritable
extends Object
implements org.apache.hadoop.io.WritableComparable<TupleWritable>

A straight copy of the TupleWritable implementation in the join package, added here because of its package visibility restrictions.


Constructor Summary
TupleWritable()
          Create an empty tuple with no allocated storage for writables.
TupleWritable(org.apache.hadoop.io.Writable[] vals)
          Initialize tuple with storage; unknown whether any of them contain "written" values.
 
Method Summary
 void clearWritten()
          Clear any record of which writables have been written to, without releasing storage.
 void clearWritten(int i)
          Record that the tuple does not contain an element at the position provided.
 int compareTo(TupleWritable o)
           
 boolean equals(Object other)
          
 org.apache.hadoop.io.Writable get(int i)
          Get ith Writable from Tuple.
 boolean has(int i)
          Return true if tuple has an element at the position provided.
 int hashCode()
           
 void readFields(DataInput in)
          
 void setWritten(int i)
          Record that the tuple contains an element at the position provided.
 int size()
          The number of children in this Tuple.
 String toString()
          Convert Tuple to String as in the following.
 void write(DataOutput out)
          Writes each Writable to out.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TupleWritable

public TupleWritable()
Create an empty tuple with no allocated storage for writables.


TupleWritable

public TupleWritable(org.apache.hadoop.io.Writable[] vals)
Initialize tuple with storage; unknown whether any of them contain "written" values.

Method Detail

has

public boolean has(int i)
Return true if tuple has an element at the position provided.


get

public org.apache.hadoop.io.Writable get(int i)
Get ith Writable from Tuple.


size

public int size()
The number of children in this Tuple.


equals

public boolean equals(Object other)

Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Convert Tuple to String as in the following. [,,...,]

Overrides:
toString in class Object

write

public void write(DataOutput out)
           throws IOException
Writes each Writable to out. TupleWritable format: <count><type1><type2>...<typen><obj1><obj2>...<objn>

Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException

readFields

public void readFields(DataInput in)
                throws IOException

Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
IOException

setWritten

public void setWritten(int i)
Record that the tuple contains an element at the position provided.


clearWritten

public void clearWritten(int i)
Record that the tuple does not contain an element at the position provided.


clearWritten

public void clearWritten()
Clear any record of which writables have been written to, without releasing storage.


compareTo

public int compareTo(TupleWritable o)
Specified by:
compareTo in interface Comparable<TupleWritable>


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.