All Downloads are FREE. Search and download functionalities are using the official Maven repository.

eu.luminis.websocket.LeesFile Maven / Gradle / Ivy

Go to download

JMeter add-on that defines a number of samplers for load testing WebSocket applications.

There is a newer version: 1.2.10
Show newest version
package eu.luminis.websocket;

import java.io.*;

public class LeesFile {

    public static void main(String[] args) throws Exception {
        writeFile();
    }

    static void writeFile() throws Exception {
        File file = new File("/Users/peter/tmp/bigfile");

        OutputStream out = new FileOutputStream(file);

        byte[] buffer = new byte[100_000_000];

        long start = System.currentTimeMillis();
        //out = new BufferedOutputStream(out);
        out.write(buffer);
        out.close();
        long end = System.currentTimeMillis();

        System.out.println("It took " + (end -start) + " ms");

    }


    static void readFile() throws Exception  {

        File file = new File("/Users/peter/Downloads/SW_DVD5_Visio_Pro_2016_W32_English_MLF_X20-41585.ISO");

        FileInputStream fileInputStream = new FileInputStream(file);

        BufferedInputStream buffer = new BufferedInputStream(fileInputStream);

        long start = System.currentTimeMillis();
        while (buffer.read() > -1)
            ;
        long end = System.currentTimeMillis();

        System.out.println("It took " + (end -start) + " ms");

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy