List of utility methods to do FileInputStream Read
byte[] | readFileEx(String... file) read File Ex ByteArrayOutputStream baos = new ByteArrayOutputStream(); for (String f : file) { FileInputStream fis = null; try { fis = new FileInputStream(f); byte[] buf = new byte[4096]; int cnt; while ((cnt = fis.read(buf)) > 0) { ... |
byte[] | readFileFully(File file) read File Fully byte[] buffer = new byte[BUFFER_SIZE]; ByteArrayOutputStream outStream = new ByteArrayOutputStream(); FileInputStream inStream = null; try { inStream = new FileInputStream(file); int readSize = 0; while ((readSize = inStream.read(buffer)) != -1) { outStream.write(buffer, 0, readSize); ... |
byte[] | readFileInByteArray(String aFileName) faz a leitura de um arquivo especifico em um array de byte. File file = new File(aFileName); FileInputStream fileStream = new FileInputStream(file); try { int fileSize = (int) file.length(); byte[] data = new byte[fileSize]; int bytesRead = 0; while (bytesRead < fileSize) { bytesRead += fileStream.read(data, bytesRead, fileSize - bytesRead); ... |
byte[] | readFileRaw(File file) read File Raw ByteArrayOutputStream os = new ByteArrayOutputStream(); FileInputStream is = new FileInputStream(file); byte[] buf = new byte[1024]; int ret; while ((ret = is.read(buf)) != -1) os.write(buf, 0, ret); is.close(); return os.toByteArray(); ... |
byte[] | readFileToBinary(File lessCSS) read File To Binary byte[] result; ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); FileInputStream input = new FileInputStream(lessCSS); try { byte[] buffer = new byte[1024]; int bytesRead = -1; while ((bytesRead = input.read(buffer)) != -1) { byteStream.write(buffer, 0, bytesRead); ... |
byte[] | readFileToByteArray(File file) Reads the contents of a file into a byte array. InputStream in = null; try { in = openInputStream(file); return toByteArray(in, file.length()); } finally { closeQuietly(in); |
byte[] | readFileToByteArray(File file) read File To Byte Array byte[] buffer = new byte[(int) file.length()]; InputStream ios = null; try { ios = new FileInputStream(file); if (ios.read(buffer) == -1) { throw new IOException("EOF reached while trying to read the whole file"); return buffer; ... |
byte[] | readFileToByteArray(File file) read File To Byte Array InputStream in = null; try { in = openInputStream(file); return toByteArray(in, file.length()); } finally { closeQuietly(in); |
byte[] | readFileToByteArray(String file) Reads a file storing intermediate data into an array. InputStream in = null; byte[] buf = null; int bufLen = 20 * 1024 * 1024; try { in = new BufferedInputStream(new FileInputStream(file)); buf = new byte[bufLen]; byte[] tmp = null; int len = 0; ... |
byte[] | readFileToByteArray(String filename) Read a text file and return the content as array of bytes. File file = new File(filename); ByteArrayOutputStream ous = null; InputStream ios = null; try { byte[] buffer = new byte[4096]; ous = new ByteArrayOutputStream(); ios = new FileInputStream(file); int read = 0; ... |