fileman

File Management Library

License

License

GroupId

GroupId

com.3xcool
ArtifactId

ArtifactId

fileman
Last Version

Last Version

2.2.2
Release Date

Release Date

Type

Type

aar
Description

Description

fileman
File Management Library
Project URL

Project URL

https://github.com/3xcool/Fileman
Source Code Management

Source Code Management

https://github.com/3xcool/Fileman

Download fileman

Filename Size
fileman-2.2.2.pom
Browse

How to add to project

<!-- https://jarcasting.com/artifacts/com.3xcool/fileman/ -->
<dependency>
    <groupId>com.3xcool</groupId>
    <artifactId>fileman</artifactId>
    <version>2.2.2</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.3xcool/fileman/
implementation 'com.3xcool:fileman:2.2.2'
// https://jarcasting.com/artifacts/com.3xcool/fileman/
implementation ("com.3xcool:fileman:2.2.2")
'com.3xcool:fileman:aar:2.2.2'
<dependency org="com.3xcool" name="fileman" rev="2.2.2">
  <artifact name="fileman" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.3xcool', module='fileman', version='2.2.2')
)
libraryDependencies += "com.3xcool" % "fileman" % "2.2.2"
[com.3xcool/fileman "2.2.2"]

Dependencies

compile (8)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-parcelize-runtime jar 1.4.32
org.jetbrains.kotlin : kotlin-stdlib-jdk7 jar 1.4.32
androidx.appcompat » appcompat jar 1.2.0
androidx.core » core-ktx jar 1.3.2
androidx.lifecycle » lifecycle-viewmodel-ktx jar 2.4.0-alpha01
androidx.lifecycle » lifecycle-extensions jar 2.2.0
androidx.work » work-runtime-ktx jar 2.4.0
androidx.work » work-gcm jar 2.4.0

Project Modules

There are no modules declared in this project.

Fileman

Maven Central

This is a utility API for File Management.

If you don't need to use WorkManager + Coroutine for file CRUD, check FilemanLite repository first.

I did this Library because I had a problem with multi threading writing/reading which I needed to guarantee the log chronology and to keep the job working even when the app is not running anymore.

Dependency

In build.graddle (app)

dependencies {
implementation 'com.3xcool:fileman:$LATEST_VERSION'
}

Drivers

Use FilemanDrivers enum class:

  1. SandBox: Where the app is installed (can't be accessed by other apps)
  2. Internal: Device storage (can be accessed by other apps)
  3. External: SD Card if available

Simple CRUD

Don't call these functions on the Main Thread to avoid UI freeze.

Fileman.write(fileContent: String, context: Context, drive: Int, folder: String, filename: String, append: Boolean)
Fileman.read(context: Context, drive: Int, folder: String, filename: String)
Fileman.delete(context: Context, drive: Int, folder: String, filename: String)

WorkManager (advanced)

For WorkManager use FilemanWM class instead.

Create an object

filemanWM = FilemanWM(context, viewLifecycleOwner)

Call Launch or Async CRUD functions

Obs: Launch and Async are Coroutine nomenclatures, see Kotlin Coroutine to see the difference.

val res = filemanWM.writeLaunch("filecontent", context, drive, folder, filename, append = true, withTimeout = true, timeout = 10000L)
//return a FilemanFeedback Class.

Return

Get the return from filemanFeedback and errorFeedback LiveData.

   filemanWM.filemanFeedback.observe(this, Observer { output ->
      updateText(output)
    })
    
    filemanWM.errorFeedback.observe(this, Observer { output ->
      updateText(output)
    })

Some WorkManager utility fun

cancelWorkById(), cancelAllWorks() and pruneWork()

License

Copyright 2020 André Filgueiras

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Versions

Version
2.2.2
2.2.0