-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The Prerelease 1 is coming! Main changes are:
- JVM has finally got its actual implementations - JVM implementation of FileContainer now uses its private fileInputStream to read the file in stream manner - readUntil JVM implementation (currently its only implementation) is a now way more optimized than initial - thanks to previous change readLine now cuts '\n' on the end by default - writing is also included. Unlike C/C++ file APIs, when this library will come to Kotlin/Native, you will be able to change between appending and overwriting on the fly just by using two dedicated functions
- Loading branch information
Showing
21 changed files
with
271 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/commonMain/kotlin/com/bpavuk/filery/exceptions/FileAlreadyClosedException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.bpavuk.filery.exceptions | ||
|
||
public class FileAlreadyClosedException(fileName: String) : RuntimeException("File $fileName already closed") |
3 changes: 3 additions & 0 deletions
3
src/commonMain/kotlin/com/bpavuk/filery/exceptions/FileDoesNotExistException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.bpavuk.filery.exceptions | ||
|
||
public class FileDoesNotExistException(fileName: String) : RuntimeException("file $fileName does not exist") |
3 changes: 3 additions & 0 deletions
3
src/commonMain/kotlin/com/bpavuk/filery/exceptions/FileNotOpenException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.bpavuk.filery.exceptions | ||
|
||
public class FileNotOpenException(fileName: String) : RuntimeException("file $fileName is not open") |
53 changes: 50 additions & 3 deletions
53
src/commonMain/kotlin/com/bpavuk/filery/expects/FileContainer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.bpavuk.filery.types | ||
|
||
public enum class FileType { | ||
FILE, | ||
DIRECTORY, | ||
// more to come | ||
} |
2 changes: 1 addition & 1 deletion
2
...monMain/kotlin/com/bpavuk/filery/Modes.kt → ...n/kotlin/com/bpavuk/filery/types/Modes.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...mmonMain/kotlin/com/bpavuk/filery/Path.kt → ...in/kotlin/com/bpavuk/filery/types/Path.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package com.bpavuk.filery | ||
package com.bpavuk.filery.types | ||
|
||
public data class Path(public val path: String) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import com.bpavuk.filery.filery | ||
import kotlinx.coroutines.test.runTest | ||
import kotlin.test.Test | ||
import kotlin.test.assertTrue | ||
|
||
class ReadTest { | ||
@Test | ||
fun testRead() = runTest { | ||
filery("/home/bpavuk/fuckery.txt") { | ||
assertTrue { | ||
readLine(cutLineEscape = false) == "fuckery\n" | ||
} | ||
} | ||
filery("/home/bpavuk/fuckery.txt") { | ||
assertTrue { | ||
readBytes(3).decodeToString() == "fuc" | ||
} | ||
assertTrue { readLine() == "kery" } | ||
} | ||
filery("/home/bpavuk/fuckery.txt") { | ||
assertTrue { | ||
readBytes().decodeToString() == "fuckery\n" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.