eu.luminis.websocket.LeesFile Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jmeter-websocket-samplers Show documentation
Show all versions of jmeter-websocket-samplers Show documentation
JMeter add-on that defines a number of samplers for load testing WebSocket applications.
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