Java Byte Array from getBytes(String fileName)

Here you can find the source of getBytes(String fileName)

Description

get Bytes

License

Open Source License

Declaration

private static byte[] getBytes(String fileName) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class Main {
    private static byte[] getBytes(String fileName) throws IOException {
        File file = new File("src/test/resources/crc_test_files/" + fileName);
        FileInputStream fin = new FileInputStream(file);
        byte fileContent[] = new byte[(int) file.length()];
        fin.read(fileContent);//  w w w .  ja va2  s .c  om
        return fileContent;
    }
}

Related

  1. getBytes(int length, InputStream inStream)
  2. getBytes(int value)
  3. getBytes(String content)
  4. getBytes(String data, String encoding)
  5. getBytes(String defaultPlain)
  6. getBytes(String fileName)
  7. getBytes(String filePath)
  8. getBytes(String filePath, long startPos, long endPos)
  9. getBytes(String fileUrl)