M
M
maestro072020-01-14 11:32:35
Java
maestro07, 2020-01-14 11:32:35

How to count a file in Java?

Read file from folder (other) and do createImageInputStream

File file = new File("/home/nursultan/MNT_FILES/4you/Кв листы/Квартиры/Бизнес/1 очередь/Квартиры/1.jpg");
        BufferedImage img = ImageIO.read(file);
        ImageInputStream input = ImageIO.createImageInputStream(img);

input получаю null

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
postya, 2020-01-14
@postya

Try to write not a relative path to the file, but an absolute
one. If OS Windows, the path to the file can be copied like this: hold down shift and right-click on the file, the path will be copied as text in the list

C
Cheypnow, 2020-01-14
@Cheypnow

If you need exactly ImageInputStream, then you can, for example, like this:

FileInputStream fileInputStream = new FileInputStream("/home/nursultan/MNT_FILES/4you/Кв листы/Квартиры/Бизнес/1 очередь/Квартиры/1.jpg");
ImageInputStream imageInputStream = ImageIO.createImageInputStream(fileInputStream);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question