view src/samer/units/StreamToVec.java @ 8:5e3cbbf173aa tip

Reorganise some more
author samer
date Fri, 05 Apr 2019 22:41:58 +0100
parents bf79fb79ee13
children
line wrap: on
line source
//
//  StreamToVec.java
//  
//
//  Created by Samer Abdallah on Mon Jun 10 2002.
//  Copyright (c) 2002 __MyCompanyName__. All rights reserved.
//

package samer.units;

import samer.core.*;
import samer.tools.*;
import samer.maths.*;
import java.io.*;

public class StreamToVec extends AnonymousTask {
	Vec				x;
	InputStream	in;
	DataInputStream	objin;
	Viewable			obs;
	double []		a;
	
	public StreamToVec(VVector x, InputStream in) throws Exception
	{
		this.x=x;
		this.in=in;
		this.obs=x;
		objin=new DataInputStream(in);
		a=x.array();
	}

	public void dispose() {
		try { objin.close(); }
		catch (Exception ex) {}
		// close out?
	}
	public void run() throws Exception {
//		double [] read=(double[])objin.readObject();
//		Mathx.copy(read,a);
		for (int i=0; i<x.size(); i++) {
			a[i]=(double)objin.readFloat();
		}
		obs.changed();
	}
}