/** * Send standard response. * * @param code the response code to send * @param header the headers to include in the response * @throws IOException if an IO error occurs */ public void sendResponse(int code, ObexByteBuffer header) throws IOException { int totalLength = 3; mData.reset(); if (header != null) { totalLength += header.getLength(); mData.write((byte) code); mData.write((byte) (totalLength >> 8)); mData.write((byte) totalLength); mData.write(header); } else { mData.write((byte) code); mData.write((byte) 0x00); mData.write((byte) totalLength); } mData.read(mOutput); mOutput.flush(); }