Java Path File Read nio loadTestPackets(final Path path)

Here you can find the source of loadTestPackets(final Path path)

Description

load Test Packets

License

Open Source License

Declaration

public static byte[] loadTestPackets(final Path path) throws Exception 

Method Source Code

//package com.java2s;
/*/*from ww w . j  a v  a  2  s. co m*/
 * Copyright 2004-2016 EPAM Systems
 * This file is part of Java Market Data Handler for CME Market Data (MDP 3.0).
 * Java Market Data Handler for CME Market Data (MDP 3.0) is free software: you can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
 * Java Market Data Handler for CME Market Data (MDP 3.0) is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License along with Java Market Data Handler for CME Market Data (MDP 3.0).
 * If not, see <http://www.gnu.org/licenses/>.
 */

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

import java.nio.file.Path;

public class Main {
    public static byte[] loadTestPackets(final Path path) throws Exception {
        final File file = path.toFile();
        final int size = (int) file.length();
        final byte[] data = new byte[size];
        final FileInputStream in = new FileInputStream(file);
        in.read(data);
        in.close();
        return data;
    }
}

Related

  1. loadJSON(Path path)
  2. loadProperties(Path filePath)
  3. loadProperties(Supplier classLoader, String classpathResource)
  4. loadStrings(Path thePath)
  5. loadStringsFromFile(String pathToFile)
  6. loadTitles(Path rootDir, Set container)
  7. newBufferedReader(Path path)
  8. newBufferedReader(Path path)
  9. openBufferedReader(String pathOrUrl)