public void createFile(long sizeInBytes) throws IOException {
        deleteOnExit();

        FileOutputStream outputStream = new FileOutputStream(this);
        BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(outputStream);
        InputStream inputStream = new RandomInputStream(sizeInBytes, binaryData);

        try {
            byte[] buffer = new byte[1024];
            int bytesRead = -1;
            while ((bytesRead = inputStream.read(buffer)) > -1) {
                bufferedOutputStream.write(buffer, 0, bytesRead);
            }
        } finally {
            bufferedOutputStream.close();
            outputStream.close();
            inputStream.close();
        }
    }
Creates, and fills, a temp file with the specified name and specified
size of random binary or character data.

@param filename
           The name for the new temporary file, within the Java temp
           directory as declared in the JRE's system properties.
@param sizeInBytes
           The amount of random ASCII data, in bytes, for the new temp
           file.
@param binaryData Whether to fill the file with binary or character data.

@throws IOException
            If any problems were encountered creating the new temp file.
aws-java-sdk-test-utils/src/main/java/com/amazonaws/test/util/RandomTempFile.java