public void write(DataOutput out) throws IOException {
  if (array == null) {
    out.writeLong(0);
    return;
  }
  DataBuffer data=array.data();
  DataBuffer.Type type=data.dataType();
  out.writeLong(array.length());
  out.writeInt(type.ordinal());
switch (type) {
case DOUBLE:
{
      DoubleBuffer buffer=data.asNioDouble();
      while (buffer.remaining() > 0) {
        out.writeDouble(buffer.get());
      }
      return;
    }
case FLOAT:
{
    FloatBuffer buffer=data.asNioFloat();
    while (buffer.remaining() > 0) {
      out.writeFloat(buffer.get());
    }
    return;
  }
case INT:
{
  IntBuffer buffer=data.asNioInt();
  while (buffer.remaining() > 0) {
    out.writeInt(buffer.get());
  }
  return;
}
}
throw new UnsupportedOperationException("Unsupported data type: " + type);
}

public void write ( DataOutput out ) throws IOException { if ( array == null ) { out . writeLong ( 0 ) ; return ; } DataBuffer data = array . data ( ) ; DataBuffer . Type type = data . dataType ( ) ; out . writeLong ( array . length ( ) ) ; out . writeInt ( type . ordinal ( ) ) ; switch ( type ) { case DOUBLE : { DoubleBuffer buffer = data . asNioDouble ( ) ; while ( buffer . remaining ( ) > 0 ) { out . writeDouble ( buffer . get ( ) ) ; } return ; } case FLOAT : { FloatBuffer buffer = data . asNioFloat ( ) ; while ( buffer . remaining ( ) > 0 ) { out . writeFloat ( buffer . get ( ) ) ; } return ; } case INT : { IntBuffer buffer = data . asNioInt ( ) ; while ( buffer . remaining ( ) > 0 ) { out . writeInt ( buffer . get ( ) ) ; } return ; } } throw new UnsupportedOperationException ( "Unsupported data type: " + type ) ; }
serialize array data linearly .
