Here you can find the source of readFileToBinary(File lessCSS)
public static byte[] readFileToBinary(File lessCSS) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; public class Main { public static byte[] readFileToBinary(File lessCSS) throws IOException { byte[] result; ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); FileInputStream input = new FileInputStream(lessCSS); try {// w w w. jav a 2 s. c o m byte[] buffer = new byte[1024]; int bytesRead = -1; while ((bytesRead = input.read(buffer)) != -1) { byteStream.write(buffer, 0, bytesRead); } result = byteStream.toByteArray(); } finally { byteStream.close(); input.close(); } return result; } }