public Sample(BufferedReader reader, int numChannels) { try { String line = reader.readLine();  StringTokenizer tok = new StringTokenizer(line); if (!tok.nextToken().equals("FRAME")) { throw new Error("frame Parsing sample error"); }  frameData = new short[numChannels];  for (int i = 0; i < numChannels; i++) { int svalue = Integer.parseInt(tok.nextToken()) - 32768;  if ( svalue <  -32768 || svalue > 32767) { throw new Error("data out of short range"); } frameData[i] = (short) svalue; }  line = reader.readLine(); tok = new StringTokenizer(line); if (!tok.nextToken().equals("RESIDUAL")) { throw new Error("residual Parsing sample error"); }  residualSize = Integer.parseInt(tok.nextToken()); residualData = new byte[residualSize];  for (int i = 0; i < residualSize; i++) { int bvalue = Integer.parseInt(tok.nextToken()) - 128;  if ( bvalue < -128 || bvalue > 127) { throw new Error("data out of byte range"); } residualData[i] = (byte) bvalue; } } catch (NoSuchElementException nse) { throw new Error("Parsing sample error " + nse.getMessage()); } catch (IOException ioe) { throw new Error("IO error while parsing sample" + ioe.getMessage()); }
public Sample(short[] frameData, byte[] residualData) { this.frameData = frameData; this.residualData = residualData;
    public Sample(BufferedReader reader, int numChannels) {	try {	    String line = reader.readLine();	    StringTokenizer tok = new StringTokenizer(line);	    if (!tok.nextToken().equals("FRAME")) {		throw new Error("frame Parsing sample error");	    }	    frameData = new short[numChannels];	    for (int i = 0; i < numChannels; i++) {		int svalue = Integer.parseInt(tok.nextToken()) - 32768;			if ( svalue <  -32768 || svalue > 32767) {		    throw new Error("data out of short range");		}		frameData[i] = (short) svalue;	    }	    line = reader.readLine();	    tok = new StringTokenizer(line);	    if (!tok.nextToken().equals("RESIDUAL")) {		throw new Error("residual Parsing sample error");	    }	    residualSize = Integer.parseInt(tok.nextToken());	    residualData = new byte[residualSize];	    for (int i = 0; i < residualSize; i++) {		int bvalue = Integer.parseInt(tok.nextToken()) - 128;		if ( bvalue < -128 || bvalue > 127) {		    throw new Error("data out of byte range");		}		residualData[i] = (byte) bvalue;	    }	} catch (NoSuchElementException nse) {	    throw new Error("Parsing sample error " + nse.getMessage());	} catch (IOException ioe) {	    throw new Error("IO error while parsing sample" + ioe.getMessage());	}    }