Questions tagged [apache-commons-io]

Apache Commons IO is a library of utilities to assist with developing IO functionality.

Apache Commons Commons IO is a library of utilities to assist with developing IO functionality.

There are six main areas included:

  • Utility classes - with static methods to perform common tasks
  • Input - useful Input Stream and Reader implementations
  • Output - useful Output Stream and Writer implementations
  • Filters - various implementations of file filters
  • Comparators - various implementations of java.util.Comparator for files
  • File Monitor - a component for monitoring file system events

Official Website: http://commons.apache.org/io/

Useful Links:

Related Tags:

175 questions
5
votes
1 answer

Apache Commons IO File Monitoring vs. JDK WatchService

I need to develop an application that will process csv files as soon as the files are created in a predefined directory. Huge number of incoming files is expected. I have seen applications using Apache Commons IO File Monitoring in the production.…
Saptarshi Basu
  • 6,115
  • 3
  • 35
  • 46
5
votes
1 answer

How to debug NoSuchMethodError exception?

I am running the following code package test.commons; import java.io.File; import java.io.IOException; import org.apache.commons.io.FileUtils; public class Try_FileUtilsWrite { public static void main(String[] args) throws IOException { …
Suzan Cioc
  • 26,725
  • 49
  • 190
  • 355
5
votes
1 answer

Clone InputStream

I'm trying to read data from an InputStream, which could either be a FileInputStream or an ObjectInputStream. In order to achieve this I'wanted to clone the stream and try to read the Object and in case of an exception convert the stream to a…
Jan B
  • 498
  • 1
  • 3
  • 16
5
votes
1 answer

Java: list files recursively in subdirectories with Apache commons-IO 2.4

I'm trying to list files with the extension ".xls" in the root directory and its sub-directories, using the following code with Apache Commons-IO 2.4 library. I am checking the size of the collection, but it gives 0. I don't see where could be…
TonyGW
  • 15,511
  • 38
  • 93
  • 165
5
votes
4 answers

Java process hanging on IOUtils. Suspected deadlock

I have a java process that is hanging in a call to IOUtils.toString with the following code: String html = ""; try { html = IOUtils.toString(someUrl.openStream(), "utf-8"); // process hangs on this line } catch (Exception e) { return…
matt burns
  • 22,440
  • 9
  • 91
  • 102
5
votes
2 answers

IOUtils.copy and IOUtils.copyLarge are very slow

I've implemented a REST service for downloading a moderately large (250 Mb) zip file using IOUtils.copy(), similar to Most effective way to write file to servletoutputstream. The REST service is called from another app using HttpURLConnection. I use…
Brett Slocum
  • 358
  • 1
  • 5
  • 21
5
votes
2 answers

Progress bar with Apache FileUtils.copyDirectory(...)

Does anyone know any way of implementing progress bar for Apache's FileUtils.copyDirectory(File src, File dst)? I don't see anything helpful in JavaDocs and API. Seems like a common use case in dealing with batch disk operations, so I'm not sure if…
ŁukaszBachman
  • 32,989
  • 10
  • 61
  • 69
4
votes
0 answers

Error : javax.net.ssl.SSLException: Connection reset (Specific Website only)

Kind Attn Moderators: Before marking this query as duplicate, please note I have checked - Link1, Link2, Link3 & was unable to fix the issue. Also I believe the context & error is different from those, thus seeking help here. Context: Download a csv…
iCoder
  • 1,135
  • 3
  • 14
  • 27
4
votes
3 answers

in java TailListener,how to avoid duplicate log messages

my code is given below . public static void main(String[] args) { // TODO code application logic here File pcounter_log = new File("c:\development\temp\test.log"); try { TailerListener listener = new PCTailListener(); …
ssbecse
  • 113
  • 1
  • 5
4
votes
1 answer

Java wildcard expansion

I need to expand wildcards in a filepath to get a list of files that match the filepath. I used commons-io from apache: protected File[] wildcardResolution(File f) { File dir = f.getParentFile(); FileFilter fileFilter = new…
alem0lars
  • 660
  • 2
  • 10
  • 23
4
votes
1 answer

Error "java.lang.NoClassDefFoundError: com.google.repacked.apache.commons.io.FileUtils"

An Android app has the following in its build.gradle: dependencies { ... compile 'commons-io:commons-io:2.4' } Building and installing the app has no problem. However the following code: FileUtils.writeStringToFile(fText, "Test"); causes…
Hong
  • 15,059
  • 14
  • 64
  • 105
4
votes
2 answers

Make resource xml configurable, while make tests in java?

I have to test over 100+ different situations and for every one I need external xml which to be read and parsed. I use: String xml = IOUtils.toString( this.getClass().getResourceAsStream(path),encoding); For example my test…
Xelian
  • 14,624
  • 22
  • 83
  • 129
4
votes
2 answers

Commons-Io Duplicate Entry Error Using Robospice and Android Studio

I've been working on the following issue for several hours, but haven't come up with a way to solve my problem. I've tried the following fixes from Stack Overflow (Android Studio update to 1.0 corrupts MultiDex and Duplicate Zip Entry after Gradle…
reggie3
  • 898
  • 2
  • 11
  • 21
4
votes
0 answers

apache.commons.io.IOUtils throw out of memory error

I'm using the following code to get the string representation of server response. The problem is that it's throwing an out of memory exception when it tries to pass the response toString(). This code is running on Android. String resp =…
Sam
  • 5,427
  • 7
  • 64
  • 78
4
votes
1 answer

commons io 403 for URL but httpclient is ok

commons io code : String resultURL = String.format(GOOGLE_RECOGNIZER_URL, URLEncoder.encode("hello", "UTF-8"), "en-US"); URI uri = new URI(resultURL); byte[] resultIO = IOUtils.toByteArray(uri); I got this exception: Exception in thread "main"…
Felix
  • 1,195
  • 7
  • 20
  • 40
1
2
3
11 12