public long[,] getLongData(int first, int last) { DataDescription dd = new DataDescription(); ByteBuffer buf = getRawData(first, last, dd); int nSamples = dd.nSamples; int nChans = dd.nChans; long[,] data = new long[nSamples, nChans]; switch (dd.dataType) { case DataType.INT8: for (int i = 0; i < nSamples; i++) { for (int j = 0; j < nChans; j++) { data[i, j] = (int)buf.get(); } } break; case DataType.INT16: for (int i = 0; i < nSamples; i++) { for (int j = 0; j < nChans; j++) { data[i, j] = (int)buf.getShort(); } } break; case DataType.INT32: for (int i = 0; i < nSamples; i++) { for (int j = 0; j < nChans; j++) { data[i, j] = (int)buf.getInt(); } } break; case DataType.INT64: LongBuffer lBuf = buf.asLongBuffer(); long[] rowData; for (int n = 0; n < nSamples; n++) { rowData = getRow <long>(data, n); lBuf.get(rowData); } break; default: throw new IOException("Not supported yet - returning zeros."); } return(data); }
public LongBuffer asLongBuffer() { LongBuffer longbuffer = new LongBuffer(this); return(longbuffer); }