add default empty constructor for hadoop version
diff --git a/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/KmerBytesWritable.java b/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/KmerBytesWritable.java
index 59159e9..5d1cc11 100644
--- a/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/KmerBytesWritable.java
+++ b/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/KmerBytesWritable.java
@@ -32,11 +32,32 @@
/**
*
*/
- private static final long serialVersionUID = 1L;
- protected int size;
+ private static final long serialVersionUID = 1L;
+ private static final byte[] EMPTY_BYTES = {};
+
+ protected int size;
protected byte[] bytes;
protected int kmerlength;
+ @Deprecated
+ public KmerBytesWritable() {
+ this(0, EMPTY_BYTES);
+ }
+
+ public KmerBytesWritable(int k, byte[] storage) {
+ this.kmerlength = k;
+ if (k > 0){
+ this.size = KmerUtil.getByteNumFromK(kmerlength);
+ this.bytes = storage;
+ if (this.bytes.length < size){
+ throw new ArrayIndexOutOfBoundsException("Storage is smaller than required space for kmerlength:k");
+ }
+ }else{
+ this.bytes = storage;
+ this.size = 0;
+ }
+ }
+
/**
* Initial Kmer space by kmerlength
*
@@ -213,7 +234,7 @@
public void readFields(DataInput in) throws IOException {
this.kmerlength = in.readInt();
this.size = KmerUtil.getByteNumFromK(kmerlength);
- if ( this.bytes.length < this.size){
+ if (this.bytes.length < this.size) {
this.bytes = new byte[this.size];
}
in.readFully(bytes, 0, size);
diff --git a/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/VKmerBytesWritable.java b/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/VKmerBytesWritable.java
index 3319cad..493191a 100644
--- a/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/VKmerBytesWritable.java
+++ b/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/VKmerBytesWritable.java
@@ -7,10 +7,14 @@
*
*/
private static final long serialVersionUID = 1L;
- public static final int DEFAULT_KMER_LENGTH = 21;
+ @Deprecated
public VKmerBytesWritable() {
- this(DEFAULT_KMER_LENGTH);
+ super();
+ }
+
+ public VKmerBytesWritable(int k, byte[] storage){
+ super(k, storage);
}
public VKmerBytesWritable(int k) {