TargetDataLine line;
DataLine.Info info = new DataLine.Info(TargetDataLine.class,
format);
if (!AudioSystem.isLineSupported(info)) {
throw new JbrainException("Line not supported.");
}
byte[] data = new byte[dataSize];
try {
line = (TargetDataLine) AudioSystem.getLine(info);
line.open(format);
line.read(data, 0, data.length);
line.flush();
line.close();
} catch (LineUnavailableException ex) {
throw new JbrainException(ex.getMessage());
}
return ArrayUtils.toObject(data);
}