You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by se...@apache.org on 2014/07/08 14:18:24 UTC
[2/5] [FLINK-994] Replaced DataInput and DataOutput with
DataInputView and DataOutputView
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/impl/types/InternalInstanceProfilingData.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/impl/types/InternalInstanceProfilingData.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/impl/types/InternalInstanceProfilingData.java
index a39f597..3256be2 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/impl/types/InternalInstanceProfilingData.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/impl/types/InternalInstanceProfilingData.java
@@ -13,10 +13,10 @@
package eu.stratosphere.nephele.profiling.impl.types;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.nephele.instance.InstanceConnectionInfo;
public class InternalInstanceProfilingData implements InternalProfilingData {
@@ -145,7 +145,7 @@ public class InternalInstanceProfilingData implements InternalProfilingData {
}
@Override
- public void read(DataInput in) throws IOException {
+ public void read(DataInputView in) throws IOException {
this.freeMemory = in.readLong();
this.ioWaitCPU = in.readInt();
@@ -166,7 +166,7 @@ public class InternalInstanceProfilingData implements InternalProfilingData {
}
@Override
- public void write(DataOutput out) throws IOException {
+ public void write(DataOutputView out) throws IOException {
out.writeLong(this.freeMemory);
out.writeInt(this.ioWaitCPU);
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/impl/types/InternalOutputGateProfilingData.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/impl/types/InternalOutputGateProfilingData.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/impl/types/InternalOutputGateProfilingData.java
index b6a1986..df4bb58 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/impl/types/InternalOutputGateProfilingData.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/impl/types/InternalOutputGateProfilingData.java
@@ -13,10 +13,10 @@
package eu.stratosphere.nephele.profiling.impl.types;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.nephele.executiongraph.ExecutionVertexID;
import eu.stratosphere.nephele.jobgraph.JobID;
@@ -50,7 +50,7 @@ public class InternalOutputGateProfilingData implements InternalProfilingData {
}
@Override
- public void read(DataInput in) throws IOException {
+ public void read(DataInputView in) throws IOException {
this.jobId.read(in);
this.executionVertexID.read(in);
@@ -60,7 +60,7 @@ public class InternalOutputGateProfilingData implements InternalProfilingData {
}
@Override
- public void write(DataOutput out) throws IOException {
+ public void write(DataOutputView out) throws IOException {
this.jobId.write(out);
this.executionVertexID.write(out);
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/impl/types/ProfilingDataContainer.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/impl/types/ProfilingDataContainer.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/impl/types/ProfilingDataContainer.java
index 1d7ad29..49112cd 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/impl/types/ProfilingDataContainer.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/impl/types/ProfilingDataContainer.java
@@ -13,8 +13,6 @@
package eu.stratosphere.nephele.profiling.impl.types;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Iterator;
@@ -22,6 +20,8 @@ import java.util.Queue;
import eu.stratosphere.core.io.IOReadableWritable;
import eu.stratosphere.core.io.StringRecord;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.util.StringUtils;
public class ProfilingDataContainer implements IOReadableWritable {
@@ -43,7 +43,7 @@ public class ProfilingDataContainer implements IOReadableWritable {
@SuppressWarnings("unchecked")
@Override
- public void read(DataInput in) throws IOException {
+ public void read(DataInputView in) throws IOException {
final int numberOfRecords = in.readInt();
for (int i = 0; i < numberOfRecords; i++) {
@@ -83,7 +83,7 @@ public class ProfilingDataContainer implements IOReadableWritable {
}
@Override
- public void write(DataOutput out) throws IOException {
+ public void write(DataOutputView out) throws IOException {
// Write the number of records
out.writeInt(this.queuedProfilingData.size());
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/InputGateProfilingEvent.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/InputGateProfilingEvent.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/InputGateProfilingEvent.java
index 9c9b6b1..c5a8d53 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/InputGateProfilingEvent.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/InputGateProfilingEvent.java
@@ -13,10 +13,10 @@
package eu.stratosphere.nephele.profiling.types;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.nephele.jobgraph.JobID;
import eu.stratosphere.nephele.managementgraph.ManagementVertexID;
@@ -96,7 +96,7 @@ public final class InputGateProfilingEvent extends VertexProfilingEvent {
@Override
- public void read(final DataInput in) throws IOException {
+ public void read(final DataInputView in) throws IOException {
super.read(in);
this.gateIndex = in.readInt();
@@ -105,7 +105,7 @@ public final class InputGateProfilingEvent extends VertexProfilingEvent {
@Override
- public void write(final DataOutput out) throws IOException {
+ public void write(final DataOutputView out) throws IOException {
super.write(out);
out.writeInt(this.gateIndex);
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/InstanceProfilingEvent.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/InstanceProfilingEvent.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/InstanceProfilingEvent.java
index fb4b460..ffd21ee 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/InstanceProfilingEvent.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/InstanceProfilingEvent.java
@@ -13,10 +13,10 @@
package eu.stratosphere.nephele.profiling.types;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.nephele.jobgraph.JobID;
/**
@@ -300,7 +300,7 @@ public abstract class InstanceProfilingEvent extends ProfilingEvent {
@Override
- public void read(final DataInput in) throws IOException {
+ public void read(final DataInputView in) throws IOException {
super.read(in);
this.profilingInterval = in.readInt();
@@ -324,7 +324,7 @@ public abstract class InstanceProfilingEvent extends ProfilingEvent {
@Override
- public void write(final DataOutput out) throws IOException {
+ public void write(final DataOutputView out) throws IOException {
super.write(out);
out.writeInt(this.profilingInterval);
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/OutputGateProfilingEvent.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/OutputGateProfilingEvent.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/OutputGateProfilingEvent.java
index b134c29..a8cd49f 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/OutputGateProfilingEvent.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/OutputGateProfilingEvent.java
@@ -13,10 +13,10 @@
package eu.stratosphere.nephele.profiling.types;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.nephele.jobgraph.JobID;
import eu.stratosphere.nephele.managementgraph.ManagementVertexID;
@@ -94,7 +94,7 @@ public final class OutputGateProfilingEvent extends VertexProfilingEvent {
@Override
- public void read(final DataInput in) throws IOException {
+ public void read(final DataInputView in) throws IOException {
super.read(in);
this.gateIndex = in.readInt();
@@ -103,7 +103,7 @@ public final class OutputGateProfilingEvent extends VertexProfilingEvent {
@Override
- public void write(final DataOutput out) throws IOException {
+ public void write(final DataOutputView out) throws IOException {
super.write(out);
out.writeInt(this.gateIndex);
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/ProfilingEvent.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/ProfilingEvent.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/ProfilingEvent.java
index 1d2681b..bc2454b 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/ProfilingEvent.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/ProfilingEvent.java
@@ -13,10 +13,10 @@
package eu.stratosphere.nephele.profiling.types;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.nephele.event.job.AbstractEvent;
import eu.stratosphere.nephele.event.job.ManagementEvent;
import eu.stratosphere.nephele.jobgraph.JobID;
@@ -86,7 +86,7 @@ public abstract class ProfilingEvent extends AbstractEvent implements Management
@Override
- public void read(final DataInput in) throws IOException {
+ public void read(final DataInputView in) throws IOException {
super.read(in);
this.jobID = new JobID();
@@ -97,7 +97,7 @@ public abstract class ProfilingEvent extends AbstractEvent implements Management
@Override
- public void write(final DataOutput out) throws IOException {
+ public void write(final DataOutputView out) throws IOException {
super.write(out);
this.jobID.write(out);
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/SingleInstanceProfilingEvent.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/SingleInstanceProfilingEvent.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/SingleInstanceProfilingEvent.java
index 09e0b50..901d5ea 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/SingleInstanceProfilingEvent.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/SingleInstanceProfilingEvent.java
@@ -13,11 +13,11 @@
package eu.stratosphere.nephele.profiling.types;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import eu.stratosphere.core.io.StringRecord;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.nephele.jobgraph.JobID;
/**
@@ -98,7 +98,7 @@ public final class SingleInstanceProfilingEvent extends InstanceProfilingEvent {
@Override
- public void read(DataInput in) throws IOException {
+ public void read(DataInputView in) throws IOException {
super.read(in);
this.instanceName = StringRecord.readString(in);
@@ -106,7 +106,7 @@ public final class SingleInstanceProfilingEvent extends InstanceProfilingEvent {
@Override
- public void write(DataOutput out) throws IOException {
+ public void write(DataOutputView out) throws IOException {
super.write(out);
StringRecord.writeString(out, this.instanceName);
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/ThreadProfilingEvent.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/ThreadProfilingEvent.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/ThreadProfilingEvent.java
index e33f6fd..57cbf49 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/ThreadProfilingEvent.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/ThreadProfilingEvent.java
@@ -13,10 +13,10 @@
package eu.stratosphere.nephele.profiling.types;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.nephele.jobgraph.JobID;
import eu.stratosphere.nephele.managementgraph.ManagementVertexID;
@@ -91,7 +91,7 @@ public class ThreadProfilingEvent extends VertexProfilingEvent {
@Override
- public void read(DataInput in) throws IOException {
+ public void read(DataInputView in) throws IOException {
super.read(in);
this.userTime = in.readInt();
@@ -102,7 +102,7 @@ public class ThreadProfilingEvent extends VertexProfilingEvent {
@Override
- public void write(DataOutput out) throws IOException {
+ public void write(DataOutputView out) throws IOException {
super.write(out);
out.writeInt(this.userTime);
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/VertexProfilingEvent.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/VertexProfilingEvent.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/VertexProfilingEvent.java
index 2c0fb35..e6e9ee9 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/VertexProfilingEvent.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/profiling/types/VertexProfilingEvent.java
@@ -13,10 +13,10 @@
package eu.stratosphere.nephele.profiling.types;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.nephele.jobgraph.JobID;
import eu.stratosphere.nephele.managementgraph.ManagementVertexID;
@@ -65,7 +65,7 @@ public abstract class VertexProfilingEvent extends ProfilingEvent {
@Override
- public void read(DataInput in) throws IOException {
+ public void read(DataInputView in) throws IOException {
super.read(in);
this.vertexID = new ManagementVertexID();
@@ -76,7 +76,7 @@ public abstract class VertexProfilingEvent extends ProfilingEvent {
@Override
- public void write(DataOutput out) throws IOException {
+ public void write(DataOutputView out) throws IOException {
super.write(out);
this.vertexID.write(out);
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/accumulators/AccumulatorEvent.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/accumulators/AccumulatorEvent.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/accumulators/AccumulatorEvent.java
index 08f18a2..be5429b 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/accumulators/AccumulatorEvent.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/accumulators/AccumulatorEvent.java
@@ -13,14 +13,14 @@
package eu.stratosphere.nephele.services.accumulators;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import eu.stratosphere.api.common.accumulators.Accumulator;
import eu.stratosphere.core.io.IOReadableWritable;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.nephele.execution.librarycache.LibraryCacheManager;
import eu.stratosphere.nephele.jobgraph.JobID;
import eu.stratosphere.util.StringUtils;
@@ -60,7 +60,7 @@ public class AccumulatorEvent implements IOReadableWritable {
}
@Override
- public void write(DataOutput out) throws IOException {
+ public void write(DataOutputView out) throws IOException {
out.writeBoolean(this.useUserClassLoader);
jobID.write(out);
out.writeInt(accumulators.size());
@@ -74,7 +74,7 @@ public class AccumulatorEvent implements IOReadableWritable {
@SuppressWarnings("unchecked")
@Override
- public void read(DataInput in) throws IOException {
+ public void read(DataInputView in) throws IOException {
this.useUserClassLoader = in.readBoolean();
jobID = new JobID();
jobID.read(in);
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/memorymanager/AbstractPagedInputView.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/memorymanager/AbstractPagedInputView.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/memorymanager/AbstractPagedInputView.java
index 435f84f..c6ca7b9 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/memorymanager/AbstractPagedInputView.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/memorymanager/AbstractPagedInputView.java
@@ -183,44 +183,69 @@ public abstract class AbstractPagedInputView implements DataInputView {
// --------------------------------------------------------------------------------------------
// Data Input Specific methods
// --------------------------------------------------------------------------------------------
-
+
@Override
- public void readFully(byte[] b) throws IOException {
- readFully(b, 0, b.length);
+ public int read(byte[] b) throws IOException{
+ return read(b,0,b.length);
}
@Override
- public void readFully(byte[] b, int off, int len) throws IOException {
+ public int read(byte[] b, int off, int len) throws IOException{
if (off < 0 || len < 0 || off + len > b.length) {
throw new IndexOutOfBoundsException();
}
-
+
int remaining = this.limitInSegment - this.positionInSegment;
if (remaining >= len) {
this.currentSegment.get(this.positionInSegment, b, off, len);
this.positionInSegment += len;
+ return len;
}
else {
if (remaining == 0) {
- advance();
+ try {
+ advance();
+ }catch(EOFException eof){
+ return -1;
+ }
remaining = this.limitInSegment - this.positionInSegment;
}
-
+
+ int bytesRead = 0;
while (true) {
- int toRead = Math.min(remaining, len);
+ int toRead = Math.min(remaining, len-bytesRead);
this.currentSegment.get(this.positionInSegment, b, off, toRead);
off += toRead;
- len -= toRead;
-
- if (len > 0) {
- advance();
- remaining = this.limitInSegment - this.positionInSegment;
+ bytesRead += toRead;
+
+ if (len > bytesRead) {
+ try {
+ advance();
+ }catch(EOFException eof){
+ return bytesRead;
+ }
+ remaining = this.limitInSegment - this.positionInSegment;
}
else {
this.positionInSegment += toRead;
break;
}
}
+ return len;
+ }
+ }
+
+ @Override
+ public void readFully(byte[] b) throws IOException {
+ readFully(b, 0, b.length);
+ }
+
+ @Override
+ public void readFully(byte[] b, int off, int len) throws IOException {
+ int bytesRead = read(b,off,len);
+
+ if(bytesRead == -1){
+ throw new EOFException("There is no more data left in the DataInputView.");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/taskmanager/AbstractTaskResult.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/taskmanager/AbstractTaskResult.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/taskmanager/AbstractTaskResult.java
index ffb2bb2..093f9b2 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/taskmanager/AbstractTaskResult.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/taskmanager/AbstractTaskResult.java
@@ -13,12 +13,12 @@
package eu.stratosphere.nephele.taskmanager;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import eu.stratosphere.core.io.IOReadableWritable;
import eu.stratosphere.core.io.StringRecord;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.nephele.executiongraph.ExecutionVertexID;
import eu.stratosphere.nephele.util.EnumUtils;
@@ -100,7 +100,7 @@ public abstract class AbstractTaskResult implements IOReadableWritable {
@Override
- public void read(DataInput in) throws IOException {
+ public void read(DataInputView in) throws IOException {
// Read the jobID
boolean isNotNull = in.readBoolean();
@@ -118,7 +118,7 @@ public abstract class AbstractTaskResult implements IOReadableWritable {
@Override
- public void write(DataOutput out) throws IOException {
+ public void write(DataOutputView out) throws IOException {
// Write jobID
if (this.vertexID == null) {
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/taskmanager/TaskExecutionState.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/taskmanager/TaskExecutionState.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/taskmanager/TaskExecutionState.java
index 9f37293..edd442e 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/taskmanager/TaskExecutionState.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/taskmanager/TaskExecutionState.java
@@ -13,12 +13,12 @@
package eu.stratosphere.nephele.taskmanager;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import eu.stratosphere.core.io.IOReadableWritable;
import eu.stratosphere.core.io.StringRecord;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.nephele.execution.ExecutionState;
import eu.stratosphere.nephele.executiongraph.ExecutionVertexID;
import eu.stratosphere.nephele.jobgraph.JobID;
@@ -103,7 +103,7 @@ public class TaskExecutionState implements IOReadableWritable {
@Override
- public void read(final DataInput in) throws IOException {
+ public void read(final DataInputView in) throws IOException {
boolean isNotNull = in.readBoolean();
@@ -133,7 +133,7 @@ public class TaskExecutionState implements IOReadableWritable {
@Override
- public void write(final DataOutput out) throws IOException {
+ public void write(final DataOutputView out) throws IOException {
if (this.jobID == null) {
out.writeBoolean(false);
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/taskmanager/transferenvelope/RegisterTaskManagerResult.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/taskmanager/transferenvelope/RegisterTaskManagerResult.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/taskmanager/transferenvelope/RegisterTaskManagerResult.java
index b396edd..dfd2aff 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/taskmanager/transferenvelope/RegisterTaskManagerResult.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/taskmanager/transferenvelope/RegisterTaskManagerResult.java
@@ -14,10 +14,10 @@
package eu.stratosphere.nephele.taskmanager.transferenvelope;
import eu.stratosphere.core.io.IOReadableWritable;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.nephele.util.EnumUtils;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
public class RegisterTaskManagerResult implements IOReadableWritable {
@@ -39,12 +39,12 @@ public class RegisterTaskManagerResult implements IOReadableWritable {
@Override
- public void write(DataOutput out) throws IOException {
+ public void write(DataOutputView out) throws IOException {
EnumUtils.writeEnum(out, this.returnCode);
}
@Override
- public void read(DataInput in) throws IOException {
+ public void read(DataInputView in) throws IOException {
this.returnCode = EnumUtils.readEnum(in, ReturnCode.class);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/topology/NetworkNode.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/topology/NetworkNode.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/topology/NetworkNode.java
index 9f6542b..a0f7f5b 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/topology/NetworkNode.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/topology/NetworkNode.java
@@ -13,8 +13,6 @@
package eu.stratosphere.nephele.topology;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
@@ -22,6 +20,8 @@ import java.util.List;
import eu.stratosphere.core.io.IOReadableWritable;
import eu.stratosphere.core.io.StringRecord;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
public class NetworkNode implements IOReadableWritable {
@@ -209,7 +209,7 @@ public class NetworkNode implements IOReadableWritable {
@Override
- public void read(final DataInput in) throws IOException {
+ public void read(final DataInputView in) throws IOException {
this.name = StringRecord.readString(in);
@@ -228,7 +228,7 @@ public class NetworkNode implements IOReadableWritable {
@Override
- public void write(final DataOutput out) throws IOException {
+ public void write(final DataOutputView out) throws IOException {
StringRecord.writeString(out, this.name);
out.writeInt(this.childNodes.size());
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/topology/NetworkTopology.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/topology/NetworkTopology.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/topology/NetworkTopology.java
index f54a520..cba792d 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/topology/NetworkTopology.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/topology/NetworkTopology.java
@@ -14,9 +14,7 @@
package eu.stratosphere.nephele.topology;
import java.io.BufferedReader;
-import java.io.DataInput;
import java.io.DataInputStream;
-import java.io.DataOutput;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -28,6 +26,8 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import eu.stratosphere.core.io.IOReadableWritable;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
public class NetworkTopology implements IOReadableWritable {
@@ -120,14 +120,14 @@ public class NetworkTopology implements IOReadableWritable {
}
@Override
- public void read(final DataInput in) throws IOException {
+ public void read(final DataInputView in) throws IOException {
this.rootNode.read(in);
}
@Override
- public void write(final DataOutput out) throws IOException {
+ public void write(final DataOutputView out) throws IOException {
this.rootNode.write(out);
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/types/FileRecord.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/types/FileRecord.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/types/FileRecord.java
index 55b2ec6..2114407 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/types/FileRecord.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/types/FileRecord.java
@@ -13,13 +13,13 @@
package eu.stratosphere.nephele.types;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import java.util.Arrays;
import eu.stratosphere.core.io.IOReadableWritable;
import eu.stratosphere.core.io.StringRecord;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
public class FileRecord implements IOReadableWritable {
@@ -80,7 +80,7 @@ public class FileRecord implements IOReadableWritable {
@Override
- public void read(final DataInput in) throws IOException {
+ public void read(final DataInputView in) throws IOException {
this.fileName = StringRecord.readString(in);
final int newLength = in.readInt();
@@ -90,7 +90,7 @@ public class FileRecord implements IOReadableWritable {
@Override
- public void write(final DataOutput out) throws IOException {
+ public void write(final DataOutputView out) throws IOException {
StringRecord.writeString(out, fileName);
out.writeInt(this.bytes.length);
out.write(this.bytes, 0, this.bytes.length);
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/types/IntegerRecord.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/types/IntegerRecord.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/types/IntegerRecord.java
index 09ca0b4..8141384 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/types/IntegerRecord.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/types/IntegerRecord.java
@@ -13,11 +13,11 @@
package eu.stratosphere.nephele.types;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import eu.stratosphere.core.io.IOReadableWritable;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
/**
* This class represents record for integer values.
@@ -65,13 +65,13 @@ public class IntegerRecord implements IOReadableWritable {
}
@Override
- public void read(final DataInput in) throws IOException {
+ public void read(final DataInputView in) throws IOException {
// Simply read the value from the stream
this.value = in.readInt();
}
@Override
- public void write(final DataOutput out) throws IOException {
+ public void write(final DataOutputView out) throws IOException {
// Simply write the value to the stream
out.writeInt(this.value);
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/util/SerializableArrayList.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/util/SerializableArrayList.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/util/SerializableArrayList.java
index 4c1dc2b..2d64269 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/util/SerializableArrayList.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/util/SerializableArrayList.java
@@ -13,14 +13,14 @@
package eu.stratosphere.nephele.util;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import eu.stratosphere.core.io.IOReadableWritable;
import eu.stratosphere.core.io.StringRecord;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.util.StringUtils;
/**
@@ -59,7 +59,7 @@ public class SerializableArrayList<E extends IOReadableWritable> extends ArrayLi
@Override
- public void write(final DataOutput out) throws IOException {
+ public void write(final DataOutputView out) throws IOException {
out.writeInt(size());
final Iterator<E> it = iterator();
@@ -76,7 +76,7 @@ public class SerializableArrayList<E extends IOReadableWritable> extends ArrayLi
@SuppressWarnings("unchecked")
@Override
- public void read(final DataInput in) throws IOException {
+ public void read(final DataInputView in) throws IOException {
// Make sure the list is empty
clear();
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/util/SerializableHashMap.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/util/SerializableHashMap.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/util/SerializableHashMap.java
index fd1200c..1a87ac1 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/util/SerializableHashMap.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/util/SerializableHashMap.java
@@ -13,8 +13,6 @@
package eu.stratosphere.nephele.util;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
@@ -22,6 +20,8 @@ import java.util.Map;
import eu.stratosphere.core.io.IOReadableWritable;
import eu.stratosphere.core.io.StringRecord;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.util.StringUtils;
/**
@@ -46,7 +46,7 @@ public class SerializableHashMap<K extends IOReadableWritable, V extends IOReada
@Override
- public void write(final DataOutput out) throws IOException {
+ public void write(final DataOutputView out) throws IOException {
out.writeInt(size());
@@ -67,7 +67,7 @@ public class SerializableHashMap<K extends IOReadableWritable, V extends IOReada
@SuppressWarnings("unchecked")
@Override
- public void read(final DataInput in) throws IOException {
+ public void read(final DataInputView in) throws IOException {
final int numberOfMapEntries = in.readInt();
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/util/SerializableHashSet.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/util/SerializableHashSet.java b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/util/SerializableHashSet.java
index 51b3c74..cd607fd 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/util/SerializableHashSet.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/util/SerializableHashSet.java
@@ -13,14 +13,14 @@
package eu.stratosphere.nephele.util;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import eu.stratosphere.core.io.IOReadableWritable;
import eu.stratosphere.core.io.StringRecord;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.util.StringUtils;
/**
@@ -42,7 +42,7 @@ public class SerializableHashSet<T extends IOReadableWritable> extends HashSet<T
@Override
- public void write(final DataOutput out) throws IOException {
+ public void write(final DataOutputView out) throws IOException {
out.writeInt(size());
@@ -60,7 +60,7 @@ public class SerializableHashSet<T extends IOReadableWritable> extends HashSet<T
@SuppressWarnings("unchecked")
// TODO: See if type safety can be improved here
@Override
- public void read(final DataInput in) throws IOException {
+ public void read(final DataInputView in) throws IOException {
final int numberOfMapEntries = in.readInt();
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/iterative/event/IterationEventWithAggregators.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/iterative/event/IterationEventWithAggregators.java b/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/iterative/event/IterationEventWithAggregators.java
index 277e56b..5d4a984 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/iterative/event/IterationEventWithAggregators.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/iterative/event/IterationEventWithAggregators.java
@@ -15,14 +15,16 @@ package eu.stratosphere.pact.runtime.iterative.event;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.DataInput;
import java.io.DataInputStream;
-import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Map;
import eu.stratosphere.api.common.aggregators.Aggregator;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
+import eu.stratosphere.core.memory.InputViewDataInputStreamWrapper;
+import eu.stratosphere.core.memory.OutputViewDataOutputStreamWrapper;
import eu.stratosphere.nephele.event.task.AbstractTaskEvent;
import eu.stratosphere.types.Value;
import eu.stratosphere.util.InstantiationUtil;
@@ -95,7 +97,7 @@ public abstract class IterationEventWithAggregators extends AbstractTaskEvent {
DataInputStream in = new DataInputStream(new ByteArrayInputStream(serializedData[i]));
try {
- v.read(in);
+ v.read(new InputViewDataInputStreamWrapper(in));
in.close();
} catch (IOException e) {
throw new RuntimeException("Error while deserializing the user-defined aggregate class.", e);
@@ -109,7 +111,7 @@ public abstract class IterationEventWithAggregators extends AbstractTaskEvent {
}
@Override
- public void write(DataOutput out) throws IOException {
+ public void write(DataOutputView out) throws IOException {
int num = this.aggNames.length;
out.writeInt(num);
@@ -122,7 +124,7 @@ public abstract class IterationEventWithAggregators extends AbstractTaskEvent {
out.writeUTF(this.aggregates[i].getClass().getName());
// aggregator value indirect as a byte array
- this.aggregates[i].write(bufferStream);
+ this.aggregates[i].write(new OutputViewDataOutputStreamWrapper(bufferStream));
bufferStream.flush();
byte[] bytes = boas.toByteArray();
out.writeInt(bytes.length);
@@ -134,7 +136,7 @@ public abstract class IterationEventWithAggregators extends AbstractTaskEvent {
}
@Override
- public void read(DataInput in) throws IOException {
+ public void read(DataInputView in) throws IOException {
int num = in.readInt();
if (num == 0) {
this.aggNames = NO_STRINGS;
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/iterative/event/TerminationEvent.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/iterative/event/TerminationEvent.java b/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/iterative/event/TerminationEvent.java
index 7f69899..b163633 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/iterative/event/TerminationEvent.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/iterative/event/TerminationEvent.java
@@ -13,10 +13,10 @@
package eu.stratosphere.pact.runtime.iterative.event;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.nephele.event.task.AbstractTaskEvent;
/**
@@ -27,8 +27,8 @@ public class TerminationEvent extends AbstractTaskEvent {
public static final TerminationEvent INSTANCE = new TerminationEvent();
@Override
- public void write(DataOutput out) throws IOException {}
+ public void write(DataOutputView out) throws IOException {}
@Override
- public void read(DataInput in) throws IOException {}
+ public void read(DataInputView in) throws IOException {}
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/iterative/event/WorkerDoneEvent.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/iterative/event/WorkerDoneEvent.java b/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/iterative/event/WorkerDoneEvent.java
index 841250b..5aee85c 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/iterative/event/WorkerDoneEvent.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/iterative/event/WorkerDoneEvent.java
@@ -13,12 +13,12 @@
package eu.stratosphere.pact.runtime.iterative.event;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import java.util.Map;
import eu.stratosphere.api.common.aggregators.Aggregator;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.types.Value;
public class WorkerDoneEvent extends IterationEventWithAggregators {
@@ -44,13 +44,13 @@ public class WorkerDoneEvent extends IterationEventWithAggregators {
}
@Override
- public void write(DataOutput out) throws IOException {
+ public void write(DataOutputView out) throws IOException {
out.writeInt(this.workerIndex);
super.write(out);
}
@Override
- public void read(DataInput in) throws IOException {
+ public void read(DataInputView in) throws IOException {
this.workerIndex = in.readInt();
super.read(in);
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/plugable/DeserializationDelegate.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/plugable/DeserializationDelegate.java b/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/plugable/DeserializationDelegate.java
index 00ac913..31dc94d 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/plugable/DeserializationDelegate.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/plugable/DeserializationDelegate.java
@@ -13,13 +13,12 @@
package eu.stratosphere.pact.runtime.plugable;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import eu.stratosphere.api.common.typeutils.TypeSerializer;
import eu.stratosphere.core.io.IOReadableWritable;
-import eu.stratosphere.core.memory.InputViewDataInputWrapper;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
public class DeserializationDelegate<T> implements IOReadableWritable {
@@ -28,12 +27,9 @@ public class DeserializationDelegate<T> implements IOReadableWritable {
private final TypeSerializer<T> serializer;
- private final InputViewDataInputWrapper wrapper;
-
-
+
public DeserializationDelegate(TypeSerializer<T> serializer) {
this.serializer = serializer;
- this.wrapper = new InputViewDataInputWrapper();
}
public void setInstance(T instance) {
@@ -45,13 +41,12 @@ public class DeserializationDelegate<T> implements IOReadableWritable {
}
@Override
- public void write(DataOutput out) throws IOException {
+ public void write(DataOutputView out) throws IOException {
throw new IllegalStateException("Serialization method called on DeserializationDelegate.");
}
@Override
- public void read(DataInput in) throws IOException {
- this.wrapper.setDelegate(in);
- this.instance = this.serializer.deserialize(this.instance, this.wrapper);
+ public void read(DataInputView in) throws IOException {
+ this.instance = this.serializer.deserialize(this.instance, in);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/plugable/SerializationDelegate.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/plugable/SerializationDelegate.java b/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/plugable/SerializationDelegate.java
index 7e940cf..8eac86d 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/plugable/SerializationDelegate.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/plugable/SerializationDelegate.java
@@ -13,13 +13,12 @@
package eu.stratosphere.pact.runtime.plugable;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import eu.stratosphere.api.common.typeutils.TypeSerializer;
import eu.stratosphere.core.io.IOReadableWritable;
-import eu.stratosphere.core.memory.OutputViewDataOutputWrapper;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
public class SerializationDelegate<T> implements IOReadableWritable {
@@ -28,12 +27,9 @@ public class SerializationDelegate<T> implements IOReadableWritable {
private final TypeSerializer<T> serializer;
- private final OutputViewDataOutputWrapper wrapper;
-
-
+
public SerializationDelegate(TypeSerializer<T> serializer) {
this.serializer = serializer;
- this.wrapper = new OutputViewDataOutputWrapper();
}
public void setInstance(T instance) {
@@ -45,14 +41,12 @@ public class SerializationDelegate<T> implements IOReadableWritable {
}
@Override
- public void write(DataOutput out) throws IOException {
- this.wrapper.setDelegate(out);
- this.serializer.serialize(this.instance, this.wrapper);
+ public void write(DataOutputView out) throws IOException {
+ this.serializer.serialize(this.instance, out);
}
-
@Override
- public void read(DataInput in) throws IOException {
+ public void read(DataInputView in) throws IOException {
throw new IllegalStateException("Deserialization method called on SerializationDelegate.");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/task/util/TaskConfig.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/task/util/TaskConfig.java b/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/task/util/TaskConfig.java
index b44a489..def7591 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/task/util/TaskConfig.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/task/util/TaskConfig.java
@@ -15,9 +15,7 @@ package eu.stratosphere.pact.runtime.task.util;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.DataInput;
import java.io.DataInputStream;
-import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
@@ -37,6 +35,10 @@ import eu.stratosphere.api.common.typeutils.TypeComparatorFactory;
import eu.stratosphere.api.common.typeutils.TypePairComparatorFactory;
import eu.stratosphere.api.common.typeutils.TypeSerializerFactory;
import eu.stratosphere.configuration.Configuration;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
+import eu.stratosphere.core.memory.InputViewDataInputStreamWrapper;
+import eu.stratosphere.core.memory.OutputViewDataOutputStreamWrapper;
import eu.stratosphere.pact.runtime.shipping.ShipStrategyType;
import eu.stratosphere.pact.runtime.task.DriverStrategy;
import eu.stratosphere.pact.runtime.task.PactDriver;
@@ -535,7 +537,7 @@ public class TaskConfig {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final DataOutputStream dos = new DataOutputStream(baos);
try {
- distribution.write(dos);
+ distribution.write(new OutputViewDataOutputStreamWrapper(dos));
} catch (IOException e) {
throw new RuntimeException("Error serializing the DataDistribution: " + e.getMessage(), e);
}
@@ -569,7 +571,7 @@ public class TaskConfig {
final DataInputStream in = new DataInputStream(bais);
try {
- distribution.read(in);
+ distribution.read(new InputViewDataInputStreamWrapper(in));
return distribution;
} catch (Exception ex) {
throw new RuntimeException("The deserialization of the encoded data distribution state caused an error"
@@ -1261,13 +1263,13 @@ public class TaskConfig {
// --------------------------------------------------------------------------------------------
@Override
- public void read(DataInput in) throws IOException {
+ public void read(DataInputView in) throws IOException {
this.prefix = in.readUTF();
this.backingConfig.read(in);
}
@Override
- public void write(DataOutput out) throws IOException {
+ public void write(DataOutputView out) throws IOException {
out.writeUTF(this.prefix);
this.backingConfig.write(out);
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/channels/ChannelCloseEvent.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/channels/ChannelCloseEvent.java b/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/channels/ChannelCloseEvent.java
index dcdcbb2..9a3ca8c 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/channels/ChannelCloseEvent.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/channels/ChannelCloseEvent.java
@@ -13,21 +13,21 @@
package eu.stratosphere.runtime.io.channels;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.nephele.event.task.AbstractEvent;
public final class ChannelCloseEvent extends AbstractEvent {
@Override
- public void read(DataInput in) throws IOException {
+ public void read(DataInputView in) throws IOException {
// Nothing to do here
}
@Override
- public void write(DataOutput out) throws IOException {
+ public void write(DataOutputView out) throws IOException {
// Nothing to do here
}
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/channels/EndOfSuperstepEvent.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/channels/EndOfSuperstepEvent.java b/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/channels/EndOfSuperstepEvent.java
index e5f9589..c68ca4e 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/channels/EndOfSuperstepEvent.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/channels/EndOfSuperstepEvent.java
@@ -13,10 +13,10 @@
package eu.stratosphere.runtime.io.channels;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.nephele.event.task.AbstractEvent;
/**
@@ -27,8 +27,8 @@ public class EndOfSuperstepEvent extends AbstractEvent {
public static final EndOfSuperstepEvent INSTANCE = new EndOfSuperstepEvent();
@Override
- public void write(DataOutput out) throws IOException {}
+ public void write(DataOutputView out) throws IOException {}
@Override
- public void read(DataInput in) throws IOException {}
+ public void read(DataInputView in) throws IOException {}
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/network/ConnectionInfoLookupResponse.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/network/ConnectionInfoLookupResponse.java b/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/network/ConnectionInfoLookupResponse.java
index aeb5025..0de4da4 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/network/ConnectionInfoLookupResponse.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/network/ConnectionInfoLookupResponse.java
@@ -16,11 +16,11 @@
package eu.stratosphere.runtime.io.network;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import eu.stratosphere.core.io.IOReadableWritable;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.runtime.io.channels.ChannelID;
public class ConnectionInfoLookupResponse implements IOReadableWritable {
@@ -66,7 +66,7 @@ public class ConnectionInfoLookupResponse implements IOReadableWritable {
}
@Override
- public void read(DataInput in) throws IOException {
+ public void read(DataInputView in) throws IOException {
this.returnCode = ReturnCode.values()[in.readInt()];
if (in.readBoolean()) {
@@ -80,7 +80,7 @@ public class ConnectionInfoLookupResponse implements IOReadableWritable {
}
@Override
- public void write(DataOutput out) throws IOException {
+ public void write(DataOutputView out) throws IOException {
out.writeInt(this.returnCode.ordinal());
if (this.remoteTarget != null) {
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/network/RemoteReceiver.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/network/RemoteReceiver.java b/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/network/RemoteReceiver.java
index ab65b4c..c188330 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/network/RemoteReceiver.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/network/RemoteReceiver.java
@@ -13,13 +13,13 @@
package eu.stratosphere.runtime.io.network;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import eu.stratosphere.core.io.IOReadableWritable;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
/**
* Objects of this class uniquely identify a connection to a remote {@link TaskManager}.
@@ -111,7 +111,7 @@ public final class RemoteReceiver implements IOReadableWritable {
@Override
- public void write(final DataOutput out) throws IOException {
+ public void write(final DataOutputView out) throws IOException {
final InetAddress ia = this.connectionAddress.getAddress();
out.writeInt(ia.getAddress().length);
@@ -123,7 +123,7 @@ public final class RemoteReceiver implements IOReadableWritable {
@Override
- public void read(final DataInput in) throws IOException {
+ public void read(final DataInputView in) throws IOException {
final int addr_length = in.readInt();
final byte[] address = new byte[addr_length];
in.readFully(address);
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/network/SenderHintEvent.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/network/SenderHintEvent.java b/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/network/SenderHintEvent.java
index 65287f7..4e926ef 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/network/SenderHintEvent.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/network/SenderHintEvent.java
@@ -13,12 +13,12 @@
package eu.stratosphere.runtime.io.network;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.nephele.event.task.AbstractEvent;
import eu.stratosphere.runtime.io.channels.ChannelID;
@@ -65,7 +65,7 @@ public final class SenderHintEvent extends AbstractEvent {
@Override
- public void write(final DataOutput out) throws IOException {
+ public void write(final DataOutputView out) throws IOException {
this.source.write(out);
this.remoteReceiver.write(out);
@@ -73,7 +73,7 @@ public final class SenderHintEvent extends AbstractEvent {
@Override
- public void read(final DataInput in) throws IOException {
+ public void read(final DataInputView in) throws IOException {
this.source.read(in);
this.remoteReceiver.read(in);
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/serialization/AdaptiveSpanningRecordDeserializer.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/serialization/AdaptiveSpanningRecordDeserializer.java b/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/serialization/AdaptiveSpanningRecordDeserializer.java
index 696915f..7f61cc0 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/serialization/AdaptiveSpanningRecordDeserializer.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/serialization/AdaptiveSpanningRecordDeserializer.java
@@ -14,9 +14,9 @@
package eu.stratosphere.runtime.io.serialization;
import eu.stratosphere.core.io.IOReadableWritable;
+import eu.stratosphere.core.memory.DataInputView;
import eu.stratosphere.core.memory.MemorySegment;
-import java.io.DataInput;
import java.io.EOFException;
import java.io.IOException;
import java.io.UTFDataFormatException;
@@ -116,7 +116,7 @@ public class AdaptiveSpanningRecordDeserializer<T extends IOReadableWritable> im
// -----------------------------------------------------------------------------------------------------------------
- private static final class NonSpanningWrapper implements DataInput {
+ private static final class NonSpanningWrapper implements DataInputView {
private MemorySegment segment;
@@ -339,11 +339,46 @@ public class AdaptiveSpanningRecordDeserializer<T extends IOReadableWritable> im
this.position += toSkip;
return toSkip;
}
+
+ @Override
+ public void skipBytesToRead(int numBytes) throws IOException {
+ int skippedBytes = skipBytes(numBytes);
+
+ if(skippedBytes < numBytes){
+ throw new EOFException("Could not skip " + numBytes + " bytes.");
+ }
+ }
+
+ @Override
+ public int read(byte[] b, int off, int len) throws IOException {
+ if(b == null){
+ throw new NullPointerException("Byte array b cannot be null.");
+ }
+
+ if(off < 0){
+ throw new IllegalArgumentException("The offset off cannot be negative.");
+ }
+
+ if(len < 0){
+ throw new IllegalArgumentException("The length len cannot be negative.");
+ }
+
+ int toRead = Math.min(len, remaining());
+ this.segment.get(this.position,b,off, toRead);
+ this.position += toRead;
+
+ return toRead;
+ }
+
+ @Override
+ public int read(byte[] b) throws IOException {
+ return read(b, 0, b.length);
+ }
}
// -----------------------------------------------------------------------------------------------------------------
- private static final class SpanningWrapper implements DataInput {
+ private static final class SpanningWrapper implements DataInputView {
private final DataOutputSerializer serializationBuffer;
@@ -525,5 +560,20 @@ public class AdaptiveSpanningRecordDeserializer<T extends IOReadableWritable> im
public String readUTF() throws IOException {
return this.serializationReadBuffer.readUTF();
}
+
+ @Override
+ public void skipBytesToRead(int numBytes) throws IOException {
+ this.serializationReadBuffer.skipBytesToRead(numBytes);
+ }
+
+ @Override
+ public int read(byte[] b, int off, int len) throws IOException {
+ return this.serializationReadBuffer.read(b, off, len);
+ }
+
+ @Override
+ public int read(byte[] b) throws IOException {
+ return this.serializationReadBuffer.read(b);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/serialization/DataInputDeserializer.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/serialization/DataInputDeserializer.java b/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/serialization/DataInputDeserializer.java
index a8a53fe..7e33120 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/serialization/DataInputDeserializer.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/serialization/DataInputDeserializer.java
@@ -15,9 +15,9 @@
package eu.stratosphere.runtime.io.serialization;
+import eu.stratosphere.core.memory.DataInputView;
import eu.stratosphere.core.memory.MemoryUtils;
-import java.io.DataInput;
import java.io.EOFException;
import java.io.IOException;
import java.io.UTFDataFormatException;
@@ -27,7 +27,7 @@ import java.nio.ByteOrder;
/**
* A simple and efficient deserializer for the {@link java.io.DataInput} interface.
*/
-public class DataInputDeserializer implements DataInput {
+public class DataInputDeserializer implements DataInputView {
private byte[] buffer;
@@ -311,4 +311,48 @@ public class DataInputDeserializer implements DataInput {
private static final long BASE_OFFSET = UNSAFE.arrayBaseOffset(byte[].class);
private static final boolean LITTLE_ENDIAN = (MemoryUtils.NATIVE_BYTE_ORDER == ByteOrder.LITTLE_ENDIAN);
+
+ @Override
+ public void skipBytesToRead(int numBytes) throws IOException {
+ int skippedBytes = skipBytes(numBytes);
+
+ if(skippedBytes < numBytes){
+ throw new EOFException("Could not skip " + numBytes +" bytes.");
+ }
+ }
+
+ @Override
+ public int read(byte[] b, int off, int len) throws IOException {
+ if(b == null){
+ throw new NullPointerException("Byte array b cannot be null.");
+ }
+
+ if(off < 0){
+ throw new IndexOutOfBoundsException("Offset cannot be negative.");
+ }
+
+ if(len < 0){
+ throw new IndexOutOfBoundsException("Length cannot be negative.");
+ }
+
+ if(b.length - off < len){
+ throw new IndexOutOfBoundsException("Byte array does not provide enough space to store requested data" +
+ ".");
+ }
+
+ if(this.position >= this.end){
+ return -1;
+ }else{
+ int toRead = Math.min(this.end-this.position, len);
+ System.arraycopy(this.buffer,this.position,b,off,toRead);
+ this.position += toRead;
+
+ return toRead;
+ }
+ }
+
+ @Override
+ public int read(byte[] b) throws IOException {
+ return read(b, 0, b.length);
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/serialization/DataOutputSerializer.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/serialization/DataOutputSerializer.java b/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/serialization/DataOutputSerializer.java
index ce088f0..ea4f694 100644
--- a/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/serialization/DataOutputSerializer.java
+++ b/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/serialization/DataOutputSerializer.java
@@ -14,9 +14,11 @@
**********************************************************************************************************************/
package eu.stratosphere.runtime.io.serialization;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.core.memory.MemoryUtils;
-import java.io.DataOutput;
+import java.io.EOFException;
import java.io.IOException;
import java.io.UTFDataFormatException;
import java.nio.ByteBuffer;
@@ -25,7 +27,7 @@ import java.nio.ByteOrder;
/**
* A simple and efficient serializer for the {@link java.io.DataOutput} interface.
*/
-public class DataOutputSerializer implements DataOutput {
+public class DataOutputSerializer implements DataOutputView {
private byte[] buffer;
@@ -257,4 +259,23 @@ public class DataOutputSerializer implements DataOutput {
private static final long BASE_OFFSET = UNSAFE.arrayBaseOffset(byte[].class);
private static final boolean LITTLE_ENDIAN = (MemoryUtils.NATIVE_BYTE_ORDER == ByteOrder.LITTLE_ENDIAN);
+
+ @Override
+ public void skipBytesToWrite(int numBytes) throws IOException {
+ if(buffer.length - this.position < numBytes){
+ throw new EOFException("Could not skip " + numBytes + " bytes.");
+ }
+
+ this.position += numBytes;
+ }
+
+ @Override
+ public void write(DataInputView source, int numBytes) throws IOException {
+ if(buffer.length - this.position < numBytes){
+ throw new EOFException("Could not write " + numBytes + " bytes. Buffer overflow.");
+ }
+
+ source.read(this.buffer, this.position, numBytes);
+ this.position += numBytes;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/services/iomanager/IOManagerITCase.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/services/iomanager/IOManagerITCase.java b/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/services/iomanager/IOManagerITCase.java
index 02190ca..5299e78 100644
--- a/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/services/iomanager/IOManagerITCase.java
+++ b/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/services/iomanager/IOManagerITCase.java
@@ -13,14 +13,14 @@
package eu.stratosphere.nephele.services.iomanager;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.EOFException;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Random;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import junit.framework.Assert;
import org.apache.commons.logging.Log;
@@ -265,12 +265,12 @@ public class IOManagerITCase {
}
@Override
- public void read(DataInput in) throws IOException {
+ public void read(DataInputView in) throws IOException {
value = in.readUTF();
}
@Override
- public void write(DataOutput out) throws IOException {
+ public void write(DataOutputView out) throws IOException {
out.writeUTF(this.value);
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/services/iomanager/IOManagerPerformanceBenchmark.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/services/iomanager/IOManagerPerformanceBenchmark.java b/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/services/iomanager/IOManagerPerformanceBenchmark.java
index 7936a95..bcb0335 100644
--- a/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/services/iomanager/IOManagerPerformanceBenchmark.java
+++ b/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/services/iomanager/IOManagerPerformanceBenchmark.java
@@ -26,6 +26,8 @@ import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.util.List;
+import eu.stratosphere.core.memory.InputViewDataInputStreamWrapper;
+import eu.stratosphere.core.memory.OutputViewDataOutputStreamWrapper;
import junit.framework.Assert;
import org.apache.commons.logging.Log;
@@ -251,7 +253,7 @@ public class IOManagerPerformanceBenchmark
int valsLeft = NUM_INTS_WRITTEN;
while (valsLeft-- > 0) {
rec.setValue(valsLeft);
- rec.write(daos);
+ rec.write(new OutputViewDataOutputStreamWrapper(daos));
}
daos.close();
daos = null;
@@ -267,7 +269,7 @@ public class IOManagerPerformanceBenchmark
valsLeft = NUM_INTS_WRITTEN;
while (valsLeft-- > 0) {
- rec.read(dais);
+ rec.read(new InputViewDataInputStreamWrapper(dais));
}
dais.close();
dais = null;
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/CommonTestUtils.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/CommonTestUtils.java b/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/CommonTestUtils.java
index 8e4a68c..679cc0e 100644
--- a/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/CommonTestUtils.java
+++ b/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/CommonTestUtils.java
@@ -25,6 +25,8 @@ import java.io.IOException;
import eu.stratosphere.configuration.ConfigConstants;
import eu.stratosphere.configuration.GlobalConfiguration;
import eu.stratosphere.core.io.IOReadableWritable;
+import eu.stratosphere.core.memory.InputViewDataInputStreamWrapper;
+import eu.stratosphere.core.memory.OutputViewDataOutputStreamWrapper;
/**
* This class contains auxiliary methods for unit tests in the Nephele common module.
@@ -95,7 +97,7 @@ public class CommonTestUtils {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final DataOutputStream dos = new DataOutputStream(baos);
- original.write(dos);
+ original.write(new OutputViewDataOutputStreamWrapper(dos));
final String className = original.getClass().getName();
if (className == null) {
@@ -130,7 +132,7 @@ public class CommonTestUtils {
final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
final DataInputStream dis = new DataInputStream(bais);
- copy.read(dis);
+ copy.read(new InputViewDataInputStreamWrapper(dis));
return copy;
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/ManagementTestUtils.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/ManagementTestUtils.java b/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/ManagementTestUtils.java
index 7d60e8f..ebc739b 100644
--- a/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/ManagementTestUtils.java
+++ b/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/ManagementTestUtils.java
@@ -23,6 +23,8 @@ import java.io.File;
import java.io.IOException;
import eu.stratosphere.core.io.IOReadableWritable;
+import eu.stratosphere.core.memory.InputViewDataInputStreamWrapper;
+import eu.stratosphere.core.memory.OutputViewDataOutputStreamWrapper;
/**
* This class contains auxiliary methods for unit tests in the Nephele management module.
@@ -61,7 +63,7 @@ public final class ManagementTestUtils {
final DataOutputStream dos = new DataOutputStream(baos);
try {
- original.write(dos);
+ original.write(new OutputViewDataOutputStreamWrapper(dos));
} catch (IOException ioe) {
fail(ioe.getMessage());
}
@@ -100,7 +102,7 @@ public final class ManagementTestUtils {
final DataInputStream dis = new DataInputStream(bais);
try {
- copy.read(dis);
+ copy.read(new InputViewDataInputStreamWrapper(dis));
} catch (IOException e) {
fail(e.getMessage());
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/ServerTestUtils.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/ServerTestUtils.java b/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/ServerTestUtils.java
index 59de8cc..e1e6925 100644
--- a/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/ServerTestUtils.java
+++ b/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/ServerTestUtils.java
@@ -29,6 +29,8 @@ import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
import eu.stratosphere.core.io.IOReadableWritable;
+import eu.stratosphere.core.memory.InputViewDataInputStreamWrapper;
+import eu.stratosphere.core.memory.OutputViewDataOutputStreamWrapper;
import eu.stratosphere.nephele.jobmanager.JobManagerITCase;
import eu.stratosphere.nephele.protocols.ExtendedManagementProtocol;
@@ -197,7 +199,7 @@ public final class ServerTestUtils {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final DataOutputStream dos = new DataOutputStream(baos);
- original.write(dos);
+ original.write(new OutputViewDataOutputStreamWrapper(dos));
final String className = original.getClass().getName();
if (className == null) {
@@ -232,7 +234,7 @@ public final class ServerTestUtils {
final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
final DataInputStream dis = new DataInputStream(bais);
- copy.read(dis);
+ copy.read(new InputViewDataInputStreamWrapper(dis));
return copy;
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/tasks/JobFileInputVertex.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/tasks/JobFileInputVertex.java b/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/tasks/JobFileInputVertex.java
index fb0da91..6dc199f 100644
--- a/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/tasks/JobFileInputVertex.java
+++ b/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/tasks/JobFileInputVertex.java
@@ -16,8 +16,6 @@
package eu.stratosphere.nephele.util.tasks;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -29,6 +27,8 @@ import eu.stratosphere.core.fs.FileStatus;
import eu.stratosphere.core.fs.FileSystem;
import eu.stratosphere.core.fs.Path;
import eu.stratosphere.core.io.InputSplit;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.nephele.jobgraph.AbstractJobInputVertex;
import eu.stratosphere.nephele.jobgraph.JobGraph;
import eu.stratosphere.nephele.jobgraph.JobVertexID;
@@ -94,7 +94,7 @@ public final class JobFileInputVertex extends AbstractJobInputVertex {
}
@Override
- public void read(final DataInput in) throws IOException {
+ public void read(final DataInputView in) throws IOException {
super.read(in);
// Read path of the input file
@@ -106,7 +106,7 @@ public final class JobFileInputVertex extends AbstractJobInputVertex {
}
@Override
- public void write(final DataOutput out) throws IOException {
+ public void write(final DataOutputView out) throws IOException {
super.write(out);
// Write out the path of the input file
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/tasks/JobFileOutputVertex.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/tasks/JobFileOutputVertex.java b/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/tasks/JobFileOutputVertex.java
index 593b520..c1e30f2 100644
--- a/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/tasks/JobFileOutputVertex.java
+++ b/stratosphere-runtime/src/test/java/eu/stratosphere/nephele/util/tasks/JobFileOutputVertex.java
@@ -15,11 +15,11 @@
package eu.stratosphere.nephele.util.tasks;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import eu.stratosphere.core.fs.Path;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.nephele.jobgraph.AbstractJobOutputVertex;
import eu.stratosphere.nephele.jobgraph.JobGraph;
import eu.stratosphere.nephele.jobgraph.JobVertexID;
@@ -83,7 +83,7 @@ public class JobFileOutputVertex extends AbstractJobOutputVertex {
}
@Override
- public void read(final DataInput in) throws IOException {
+ public void read(final DataInputView in) throws IOException {
super.read(in);
// Read path of the input file
@@ -95,7 +95,7 @@ public class JobFileOutputVertex extends AbstractJobOutputVertex {
}
@Override
- public void write(final DataOutput out) throws IOException {
+ public void write(final DataOutputView out) throws IOException {
super.write(out);
// Write out the path of the input file
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/test/java/eu/stratosphere/pact/runtime/iterative/event/EventWithAggregatorsTest.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/test/java/eu/stratosphere/pact/runtime/iterative/event/EventWithAggregatorsTest.java b/stratosphere-runtime/src/test/java/eu/stratosphere/pact/runtime/iterative/event/EventWithAggregatorsTest.java
index 8204eed..1a8eddd 100644
--- a/stratosphere-runtime/src/test/java/eu/stratosphere/pact/runtime/iterative/event/EventWithAggregatorsTest.java
+++ b/stratosphere-runtime/src/test/java/eu/stratosphere/pact/runtime/iterative/event/EventWithAggregatorsTest.java
@@ -22,6 +22,8 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import eu.stratosphere.core.memory.InputViewDataInputStreamWrapper;
+import eu.stratosphere.core.memory.OutputViewDataOutputStreamWrapper;
import org.junit.Assert;
import org.junit.Test;
@@ -94,7 +96,7 @@ public class EventWithAggregatorsTest {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
- event.write(out);
+ event.write(new OutputViewDataOutputStreamWrapper(out));
out.flush();
byte[] data = baos.toByteArray();
@@ -103,7 +105,7 @@ public class EventWithAggregatorsTest {
DataInputStream in = new DataInputStream(new ByteArrayInputStream(data));
IterationEventWithAggregators newEvent = event.getClass().newInstance();
- newEvent.read(in);
+ newEvent.read(new InputViewDataInputStreamWrapper(in));
in.close();
return newEvent;
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/test/java/eu/stratosphere/pact/runtime/task/util/OutputEmitterTest.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/test/java/eu/stratosphere/pact/runtime/task/util/OutputEmitterTest.java b/stratosphere-runtime/src/test/java/eu/stratosphere/pact/runtime/task/util/OutputEmitterTest.java
index 13fbfbc..7571759 100644
--- a/stratosphere-runtime/src/test/java/eu/stratosphere/pact/runtime/task/util/OutputEmitterTest.java
+++ b/stratosphere-runtime/src/test/java/eu/stratosphere/pact/runtime/task/util/OutputEmitterTest.java
@@ -19,6 +19,8 @@ import java.io.IOException;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
+import eu.stratosphere.core.memory.InputViewDataInputStreamWrapper;
+import eu.stratosphere.core.memory.OutputViewDataOutputStreamWrapper;
import junit.framework.Assert;
import junit.framework.TestCase;
@@ -356,9 +358,9 @@ public class OutputEmitterTest extends TestCase {
rec = new Record(1);
rec.setField(0, new IntValue());
- rec.write(out);
+ rec.write(new OutputViewDataOutputStreamWrapper(out));
rec = new Record();
- rec.read(in);
+ rec.read(new InputViewDataInputStreamWrapper(in));
} catch (IOException e) {
fail("Test erroneous");
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/test/java/eu/stratosphere/pact/runtime/task/util/RecordOutputEmitterTest.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/test/java/eu/stratosphere/pact/runtime/task/util/RecordOutputEmitterTest.java b/stratosphere-runtime/src/test/java/eu/stratosphere/pact/runtime/task/util/RecordOutputEmitterTest.java
index 2bd5d98..724c800 100644
--- a/stratosphere-runtime/src/test/java/eu/stratosphere/pact/runtime/task/util/RecordOutputEmitterTest.java
+++ b/stratosphere-runtime/src/test/java/eu/stratosphere/pact/runtime/task/util/RecordOutputEmitterTest.java
@@ -20,6 +20,8 @@ import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.util.Random;
+import eu.stratosphere.core.memory.InputViewDataInputStreamWrapper;
+import eu.stratosphere.core.memory.OutputViewDataOutputStreamWrapper;
import junit.framework.Assert;
import junit.framework.TestCase;
@@ -298,9 +300,9 @@ public class RecordOutputEmitterTest extends TestCase {
rec = new Record(1);
rec.setField(0, new IntValue());
- rec.write(out);
+ rec.write(new OutputViewDataOutputStreamWrapper(out));
rec = new Record();
- rec.read(in);
+ rec.read(new InputViewDataInputStreamWrapper(in));
} catch (IOException e) {
fail("Test erroneous");
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/test/java/eu/stratosphere/runtime/io/network/netty/InboundEnvelopeDecoderTest.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/test/java/eu/stratosphere/runtime/io/network/netty/InboundEnvelopeDecoderTest.java b/stratosphere-runtime/src/test/java/eu/stratosphere/runtime/io/network/netty/InboundEnvelopeDecoderTest.java
index 1c6270a..bf0c30b 100644
--- a/stratosphere-runtime/src/test/java/eu/stratosphere/runtime/io/network/netty/InboundEnvelopeDecoderTest.java
+++ b/stratosphere-runtime/src/test/java/eu/stratosphere/runtime/io/network/netty/InboundEnvelopeDecoderTest.java
@@ -13,6 +13,8 @@
package eu.stratosphere.runtime.io.network.netty;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.core.memory.MemorySegment;
import eu.stratosphere.nephele.event.task.AbstractEvent;
import eu.stratosphere.nephele.jobgraph.JobID;
@@ -37,8 +39,6 @@ import org.mockito.MockitoAnnotations;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Arrays;
@@ -792,12 +792,12 @@ public class InboundEnvelopeDecoderTest {
}
@Override
- public void write(DataOutput out) throws IOException {
+ public void write(DataOutputView out) throws IOException {
out.writeLong(id);
}
@Override
- public void read(DataInput in) throws IOException {
+ public void read(DataInputView in) throws IOException {
id = in.readLong();
}
@@ -830,12 +830,12 @@ public class InboundEnvelopeDecoderTest {
}
@Override
- public void write(DataOutput out) throws IOException {
+ public void write(DataOutputView out) throws IOException {
out.writeLong(id);
}
@Override
- public void read(DataInput in) throws IOException {
+ public void read(DataInputView in) throws IOException {
id = in.readLong();
}
http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/98e659e5/stratosphere-runtime/src/test/java/eu/stratosphere/runtime/io/serialization/SpanningRecordSerializerTest.java
----------------------------------------------------------------------
diff --git a/stratosphere-runtime/src/test/java/eu/stratosphere/runtime/io/serialization/SpanningRecordSerializerTest.java b/stratosphere-runtime/src/test/java/eu/stratosphere/runtime/io/serialization/SpanningRecordSerializerTest.java
index 637b7d5..1517b7b 100644
--- a/stratosphere-runtime/src/test/java/eu/stratosphere/runtime/io/serialization/SpanningRecordSerializerTest.java
+++ b/stratosphere-runtime/src/test/java/eu/stratosphere/runtime/io/serialization/SpanningRecordSerializerTest.java
@@ -13,6 +13,8 @@
package eu.stratosphere.runtime.io.serialization;
+import eu.stratosphere.core.memory.DataInputView;
+import eu.stratosphere.core.memory.DataOutputView;
import eu.stratosphere.core.memory.MemorySegment;
import eu.stratosphere.runtime.io.Buffer;
import eu.stratosphere.runtime.io.serialization.RecordSerializer.SerializationResult;
@@ -22,8 +24,6 @@ import eu.stratosphere.runtime.io.serialization.types.Util;
import junit.framework.Assert;
import org.junit.Test;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import java.util.Random;
@@ -88,11 +88,11 @@ public class SpanningRecordSerializerTest {
}
@Override
- public void write(DataOutput out) throws IOException {
+ public void write(DataOutputView out) throws IOException {
}
@Override
- public void read(DataInput in) throws IOException {
+ public void read(DataInputView in) throws IOException {
}
@Override