Skip to content
/ file-api Public

An abstract, cross-platform API for working with files and folders.

Notifications You must be signed in to change notification settings

mxro/file-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MOVED

This project has moved to javadelight/delight-files and is now part of the Java Delight Suite.

Build Status

File API

The File API library provides an abstract, cross-platform API for working with files and folders.

Why This is a very lightweight abstraction on top of vanilla java.io.File. Adding this project as a dependency to your projects should come with very little risk. Using the FileItem class is infinitely more convenient than using the standard Java classes for many use cases.

Usage

Creating a New File And Setting Its Contents

FileItem file = FilesJre.wrap(new File("/tmp"))
    
file.assertFolder("a Folder").createFile("my file.txt").setText("The content")

Reading File Contents as String

FileItem file = FilesJre.wrap(new File("/tmp/my file.txt"));

String content = file.getText();

System.out.println(content);

Traversing through Directories

FileItem file = FilesJre.wrap(new File("/"));

boolean there = file.get("tmp").get("my file.txt").exists();

More Operations

For more operations check the JavaDoc of FileItem.

Maven Dependency

<dependency>
    <groupId>de.mxro.file</groupId>
	<artifactId>file-api</artifactId>
	<version>[latest version]</version>
</dependency>

Find latest version here.

Add repository if required:

<repositories>
	<repository>
		<id>Appjangle Releases</id>
		<url>http://maven.appjangle.com/appjangle/releases</url>
	</repository>
</repositories>

Compatibility

This project is compatible with the following environments:

  • Java 1.6+
  • GWT 2.5.0+
  • Android (any)
  • OSGi (any)

Further Resources

About

An abstract, cross-platform API for working with files and folders.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages