Set parameters via command line parameters
This commit is contained in:
@@ -53,11 +53,14 @@ class Main
|
|||||||
return pixelArray;
|
return pixelArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Syntax blabla.jar x y Hostname Port Image.png
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
final int PORT = 1234;
|
final int PORT = Integer.parseInt(args[3]);;
|
||||||
final String HOSTNAME = "localhost";
|
final String HOSTNAME = args[2];
|
||||||
final int xOffset = 0;
|
final int xOffset = Integer.parseInt(args[0]);
|
||||||
final int yOffset = 0;
|
final int yOffset = Integer.parseInt(args[1]);
|
||||||
|
final String imageName = args[4];
|
||||||
|
|
||||||
InetAddress serverAddress = null;
|
InetAddress serverAddress = null;
|
||||||
try {
|
try {
|
||||||
serverAddress = InetAddress.getByName(HOSTNAME);
|
serverAddress = InetAddress.getByName(HOSTNAME);
|
||||||
@@ -66,7 +69,7 @@ class Main
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read the PNG file
|
// Read the PNG file
|
||||||
BufferedImage image = processImage("girl.png");
|
BufferedImage image = processImage(imageName);
|
||||||
ArrayList<String> pixelArray = prepareArray(image, xOffset, yOffset);
|
ArrayList<String> pixelArray = prepareArray(image, xOffset, yOffset);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user