Java Utililty Methods FileInputStream Read

List of utility methods to do FileInputStream Read

Description

The list of methods to do FileInputStream Read are organized into topic(s).

Method

voidreadFile(File srcFile, OutputStream destStream)
read File
FileInputStream srcStream = new FileInputStream(srcFile);
byte[] buf = new byte[65535];
int bytesRead;
while (true) {
    bytesRead = srcStream.read(buf);
    if (bytesRead == -1) {
        break;
    } else {
...
StringreadFile(File target)
read File
String adhocXml = null;
try {
    FileInputStream fis = new FileInputStream(target);
    byte[] all = new byte[(int) target.length()];
    fis.read(all);
    fis.close();
    adhocXml = new String(all);
    return adhocXml;
...
intreadFile(FileInputStream fileinputstream, byte abyte0[])
read File
try {
    return fileinputstream.read(abyte0);
} catch (IOException ex) {
    System.err.println("File cannot be read.");
return -1;
byte[]readFile(final File file)
Read file.
return readStream(new FileInputStream(file));
StringreadFile(final File file)
read File
try {
    return readFile(new FileInputStream(file));
} catch (IOException e) {
    throw new RuntimeException(e);
StringreadFile(final File file)
Reads a file's contents.
return readStream(new FileInputStream(file));
byte[]readFile(final InputStream stream)
Reads data from a stream.
final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
copy(stream, bytes);
return bytes.toByteArray();
byte[]readFile(final String fileNamePath)
read File
FileInputStream input = null;
byte[] daten = null;
try {
    input = new FileInputStream(fileNamePath);
    daten = new byte[input.available()];
    input.read(daten);
} finally {
    if (input != null) {
...
byte[]readFile(InputStream ios)
read File
ByteArrayOutputStream ous = new ByteArrayOutputStream();
byte[] buffer = new byte[4096];
int read = 0;
while ((read = ios.read(buffer)) != -1) {
    ous.write(buffer, 0, read);
byte[] bs = ous.toByteArray();
ous.close();
...
byte[]readFile(InputStream iStream)
read File
int bytePos = 0;
int bIn = iStream.read();
byte[] byteArray = new byte[1000];
while (bIn != -1) {
    byteArray[bytePos] = (byte) bIn;
    bytePos++;
    if (bytePos % 1000 == 0 && bytePos != 0) {
        byte[] newByteArray = new byte[bytePos + 1000];
...