public ByteBuffer getData() {
        ByteBuffer buffer = null;
        try {
            int available = ais.available();
            if(available <= 0) {
                available = ais.getFormat().getChannels() * (int) ais.getFrameLength() * ais.getFormat().getSampleSizeInBits() / 8;
            }
            byte[] buf = new byte[ais.available()];
            int read;
            int total = 0;
            while ((read = ais.read(buf, total, buf.length - total)) != -1 && total < buf.length) {
                total += read;
            }
            buffer = convertAudioBytes(buf, format.getSampleSizeInBits() == 16);
        } catch (IOException e) {
            e.printStackTrace();
        }

        try {
            ais.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

        return buffer;
    }