While loop doesn’t exit after file download

I’ve got the following code to download a file being transmitted over TCP: try (OutputStream out = new FileOutputStream(path); InputStream is = socket.getInputStream();) { byte[] …

Android File.listFiles() returns only subdirectories

I am trying to get all files and subdirectories in directory and show their names. This is the code I use: File internalStorageDir = new File(Environment.getExternalStorageDirectory().getPath()); File[…

NoSuchFileException java

So I’m currently working on a java fx project and I am trying to get my program to read 2 txt files (name.txt) and (password.txt). When I run this in IntelliJ it works as intended but when I run the …

Reading in a .txt file in Java

I am trying to write a program which reads in a a list of nodes that interact with each other within a network. This is written in a text file in the format: node1 node2 node1 node3 node2 node3 …

Extraction of string and integer from txt

I’m trying to make a simple scanner reader to read from a txt stored in C:UsersjamesDesktopprojectfiles and it’s called data “data.txt”, the thing is that the information stored is …

Java File class serialized and sent through network doesn’t have all information about file

I want to send java.io.File object through network using serialization. When i serialize some File object, send it and deserialize it on other side, it doesn’t contain all information about file. For …

cannot decrypt String from text file [closed]

In my journey to mastering Java, I started doing some AES encryption and decryption, but ran into some problems. I can encrypt and decrypt just fine using my 2 methods below. public static byte[] …

How can I get a special part in a string in Java? [closed]

I have to read commands from a file I have and take necessary actions according to each command. I was able to find out the process of reading from the file and what the command is, but I am having …

File scanner only reading last number in file

Here is the code: Scanner fileRead = new Scanner(file); while (fileRead.hasNext()) { score = (fileRead.nextInt()); } if (score >= 90) { gradeA++; …

How to get rid of – “java.io.IOException: The system cannot find the path specified”

I am trying to create a file and write to it, but I’m getting error in my path. Here is my code: @Value(“${base.location}”) private String folderName; if (StringUtils.isBlank(dateFileName)) …