Questions tagged [ioutils]

IOUtils is a [java] class in the IO subproject of Apache Commons. The class provides general IO stream manipulation utilities. Use this tag for questions about the IOUtils class.

org.apache.commons.io.IOUtils is a java class that provides general IO stream manipulation utilities including reading, writing and copying files. The class is part of the Apache Commons IO project. Apache Commons IO is a library of utilities to assist with developing IO functionality. It is a subproject of Apache Commons which is an Apache project focused on all aspects of reusable Java components.

30 questions
3
votes
1 answer

Is IOUtils broken these days? It's causing my app to not work

So I am making a movie list app that parses TMDB for information. I'm trying to use IOUtils because it makes parsing really easy, but when I put the compile command into the gradle it makes it so that I can't install my app on any phone. Here is the…
andrdoiddev
  • 349
  • 1
  • 3
  • 15
2
votes
2 answers

Replacing deprecated Java method

I have multiple calls that use deprecated methods, such as org.apache.commons.io.FileUtils.readFileToString(File file) org.apache.commons.io.IOUtils.toString(InputStream input) org.apache.commons.io.IOUtils.toInputStream(String input) Now, I do…
knallfrosch
  • 387
  • 6
  • 16
2
votes
1 answer

TDirectory.GetDirectoryRoot does not handle correctly paths of Max_Path characters

IOUtils.TDirectory.GetDirectoryRoot(Folder) gives me an error when 'Folder' is 259 chars long (yes, it includes the \ separator at the end): Project Tester.exe raised exception class EPathTooLongException with message 'The specified path is too…
Gabriel
  • 20,797
  • 27
  • 159
  • 293
1
vote
1 answer

Getting exceptions while trying to display encoded images with Thymeleaf (Java, Spring Boot)

So, i have a form that allows user to upload an image, which will be encoded with IOUtils.toByteArray and persisted to a database as a bytea. In a controller method i get this byte array and encode it to string: @GetMapping("/{user_id}") public…
no way
  • 29
  • 5
1
vote
1 answer

ioutil.ReadAll and unmarshal on nested curl response returns error due to problem in key of array struct

To give you context, I am curling to a third party endpoint, the response is similar to this one { "code": 200, "message": "Success", "data": { "list": [ { "user": "user A", "status" :…
yssachan
  • 109
  • 7
1
vote
1 answer

Why is IOUtils.closeQuietly deprecated?

IOUtils.closeQuietly seems to be deprecated in favor of TryWithResources, but how can it help me when need to close the resource in an async event listener, likte this when i'm uploading files with AmazonS3 and TransferManager? final String key =…
wutzebaer
  • 14,365
  • 19
  • 99
  • 170
1
vote
1 answer

IOUtils.copy() with input and output streams is extremely slow

As part of my web service, I have a picture repository which retrieves an image from Amazon S3 (a datastore) then returns it. This is how the method that does this looks: File getPicture(String path) throws IOException { File file =…
eyes enberg
  • 556
  • 1
  • 8
  • 30
1
vote
2 answers

Does IOUtils.toByteArray(inputStream) method internally close inputStream object?

Here is my code flow for which file content is getting lost and I think may be IOUtils.toByteArray() line is problem, please guide what is actually going wrong here. File content getting lost : InputStream stream =…
Abhishek
  • 1,558
  • 16
  • 28
1
vote
1 answer

How to upload large files to S3 using presigned URL?

I have been able to upload successully small files ~1kb but when I try uploading larger files > 1Mb I get this exception: java.io.IOException: Error writing to server at…
David
  • 229
  • 1
  • 7
0
votes
1 answer

IOUtils.copy getting crash

IOUtils.copy getting crash if size is more than 200MB, getting exception [ERR] Resource exhaustion event: the JVM was unable to allocate memory from the heap. We are using Java version 11 and allocated 2.5GB memory to our app container. My code: …
Babu
  • 440
  • 5
  • 23
0
votes
0 answers

Unable to write files after scala and spark upgrade

My project was previously using Scala version 2.11.12 which I have upgraded to 2.12.10 and the Spark version has been upgraded from 2.4.0 to 3.1.2. See the build.sbt file below with the rest of the project dependencies and versions: scalaVersion :=…
Jofbr
  • 455
  • 3
  • 23
0
votes
1 answer

java.util.regex.Matcher is unable to find anything inside a String obtained from Apache IOUtils

I have a code snippet to convert an input stream into a String. I then use java.util.regex.Matcher to find something inside the string. The following works for me: StringBuilder sb = new StringBuilder(); InputStream ins; // the InputStream…
mang4521
  • 742
  • 6
  • 22
0
votes
0 answers

IOUtils.byteArray NoSuchMethodError in Eclipse

I am running a unit test in an Eclipse project, and when I run the following JUnit test @Before public void setup() { final byte[] array = IOUtils.byteArray(); ... } I get the following error: java.lang.NoSuchMethodError:…
0
votes
1 answer

How do I convert String to S3ObjectInputStream

In one of the APIs, S3Object is converted to String using Apache IOUtils using the below steps: S3ObjectInputStream inputStream = s3Object.getObjectContent(); String streamString = IOUtils.toString(inputStream); In the other API, when I have to…
0
votes
0 answers

Exception :"main" java.lang.NoSuchMethodError: 'java.util.List org.apache.commons.io.IOUtils.readLines(java.io.InputStream, java.nio.charset.Charset)'

I am getting below error. I have tried with common.io.2.11.0/2.10.0/2.9/2.8/2.7.. Exception in thread "main" java.lang.NoSuchMethodError: 'java.util.List org.apache.commons.io.IOUtils.readLines(java.io.InputStream, java.nio.charset.Charset)' at…
1
2