From b133f7e3a7164ca904187b626bc9b90af4e84c03 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Tue, 24 Dec 2024 03:25:20 +0100 Subject: [PATCH] Rename file streams to just streams --- .../exception/io/StreamClosedException.kt | 10 +-- .../{ReadFileStream.kt => ReadStream.kt} | 8 +-- .../stream/{FileStream.kt => Stream.kt} | 72 +++++++++---------- .../{WriteFileStream.kt => WriteStream.kt} | 4 +- .../base/implementable/stream/package-info.kt | 2 +- ...yteReadFileStream.kt => ByteReadStream.kt} | 8 +-- .../{ByteFileStream.kt => ByteStream.kt} | 10 +-- ...eWriteFileStream.kt => ByteWriteStream.kt} | 12 ++-- .../implementation/stream/FileAccessStream.kt | 10 +-- .../{LoggerFileStream.kt => LoggerStream.kt} | 12 ++-- .../{NullFileStream.kt => NullStream.kt} | 16 ++--- ...gReadFileStream.kt => StringReadStream.kt} | 6 +- .../{StringFileStream.kt => StringStream.kt} | 6 +- ...riteFileStream.kt => StringWriteStream.kt} | 6 +- .../implementation/stream/package-info.kt | 4 +- .../engine/base/logging/Logger.kt | 14 ++-- .../engine/base/utility/FileAccess.kt | 4 +- 17 files changed, 102 insertions(+), 102 deletions(-) rename base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/{ReadFileStream.kt => ReadStream.kt} (80%) rename base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/{FileStream.kt => Stream.kt} (84%) rename base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/{WriteFileStream.kt => WriteStream.kt} (91%) rename base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/{ByteReadFileStream.kt => ByteReadStream.kt} (90%) rename base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/{ByteFileStream.kt => ByteStream.kt} (89%) rename base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/{ByteWriteFileStream.kt => ByteWriteStream.kt} (82%) rename base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/{LoggerFileStream.kt => LoggerStream.kt} (85%) rename base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/{NullFileStream.kt => NullStream.kt} (74%) rename base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/{StringReadFileStream.kt => StringReadStream.kt} (82%) rename base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/{StringFileStream.kt => StringStream.kt} (84%) rename base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/{StringWriteFileStream.kt => StringWriteStream.kt} (87%) diff --git a/base/src/main/kotlin/de/staropensource/engine/base/exception/io/StreamClosedException.kt b/base/src/main/kotlin/de/staropensource/engine/base/exception/io/StreamClosedException.kt index a11f5be82..95b4b7e5e 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/exception/io/StreamClosedException.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/exception/io/StreamClosedException.kt @@ -19,14 +19,14 @@ package de.staropensource.engine.base.exception.io -import de.staropensource.engine.base.implementable.stream.FileStream +import de.staropensource.engine.base.implementable.stream.Stream /** * Thrown when trying to - * access a closed [FileStream]. + * access a closed [Stream]. * - * @see FileStream - * @see FileStream.closed + * @see Stream + * @see Stream.closed * @since v1-alpha10 */ -class StreamClosedException(stream: FileStream) : RuntimeException("The file stream ${stream} was access whilst already closed") +class StreamClosedException(stream: Stream) : RuntimeException("The stream ${stream} was accessed whilst already closed") diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/ReadFileStream.kt b/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/ReadStream.kt similarity index 80% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/ReadFileStream.kt rename to base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/ReadStream.kt index 596668814..28b9f3519 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/ReadFileStream.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/ReadStream.kt @@ -20,11 +20,11 @@ package de.staropensource.engine.base.implementable.stream /** - * A read-only [FileStream]. + * A read-only [Stream]. * * @since v1-alpha10 */ -abstract class ReadFileStream : FileStream(streamMode = StreamMode.READ) { - override fun writeByte(byte: Byte): FileStream = this - override fun writeBytes(bytes: ByteArray): FileStream = this +abstract class ReadStream : Stream(streamMode = StreamMode.READ) { + override fun writeByte(byte: Byte): Stream = this + override fun writeBytes(bytes: ByteArray): Stream = this } diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/FileStream.kt b/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/Stream.kt similarity index 84% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/FileStream.kt rename to base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/Stream.kt index f593e9b9a..4015fa0f7 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/FileStream.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/Stream.kt @@ -21,7 +21,7 @@ package de.staropensource.engine.base.implementable.stream import de.staropensource.engine.base.annotation.NonKotlinContact import de.staropensource.engine.base.exception.io.IOAccessException -import de.staropensource.engine.base.implementation.stream.NullFileStream +import de.staropensource.engine.base.implementation.stream.NullStream import java.io.IOException import java.io.InputStream import java.io.OutputStream @@ -32,19 +32,19 @@ import java.io.OutputStream * @param streamMode supported [StreamMode]s * @since v1-alpha10 */ -abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { +abstract class Stream(val streamMode: StreamMode) : AutoCloseable { /** - * Companion object of [FileStream]. + * Companion object of [Stream]. * * @since v1-alpha10 */ companion object { /** - * Returns a [FileStream] which does nothing. + * Returns a [Stream] which does nothing. * * @since v1-alpha10 */ - val nullStream: FileStream = NullFileStream.instance + val nullStream: Stream = NullStream.instance } @@ -59,7 +59,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { /** * Contains the [java.io.InputStream] - * for this [FileStream] instance. + * for this [Stream] instance. * * @since v1-alpha10 */ @@ -67,7 +67,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { /** * Contains the [java.io.OutputStream] - * for this [FileStream] instance. + * for this [Stream] instance. * * @since v1-alpha10 */ @@ -112,7 +112,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { * for a single byte, just add this * line to your implementation instead: * ```kotlin - * override fun writeByte(byte: Byte): FileStream = writeBytes(byteArrayOf(byte)) + * override fun writeByte(byte: Byte): Stream = writeBytes(byteArrayOf(byte)) * ``` * * @param byte [Byte] to write @@ -121,7 +121,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { * @since v1-alpha10 */ @Throws(IOAccessException::class) - abstract fun writeByte(byte: Byte): FileStream + abstract fun writeByte(byte: Byte): Stream /** * Writes (or rather: appends) @@ -133,7 +133,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { * @since v1-alpha10 */ @Throws(IOAccessException::class) - abstract fun writeBytes(bytes: ByteArray): FileStream + abstract fun writeBytes(bytes: ByteArray): Stream /** * Writes (or rather: appends) @@ -145,7 +145,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { * @since v1-alpha10 */ @Throws(IOAccessException::class) - fun writeString(string: String): FileStream = writeBytes(string.toByteArray()) + fun writeString(string: String): Stream = writeBytes(string.toByteArray()) /** * Writes (or rather: appends) @@ -157,7 +157,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { * @since v1-alpha10 */ @Throws(IOAccessException::class) - fun write(value: Any): FileStream = writeBytes(value.toString().toByteArray()) + fun write(value: Any): Stream = writeBytes(value.toString().toByteArray()) // -----> Reading @@ -230,7 +230,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { * @since v1-alpha10 */ @Throws(IOAccessException::class) - fun skipNextByte(): FileStream { + fun skipNextByte(): Stream { readNextByte() return this } @@ -244,7 +244,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { * @since v1-alpha10 */ @Throws(IOAccessException::class) - fun skipNBytes(n: UInt): FileStream { + fun skipNBytes(n: UInt): Stream { readNBytes(n) return this } @@ -257,7 +257,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { * @since v1-alpha10 */ @Throws(IOAccessException::class) - fun skipRemainingBytes(): FileStream { + fun skipRemainingBytes(): Stream { readRemainingBytes() return this } @@ -266,8 +266,8 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { // -----> Redirection /** * Reads the next byte of this - * [FileStream] and writes it - * to the specified [FileStream]. + * [Stream] and writes it + * to the specified [Stream]. * * @param stream stream to write to * @return this instance @@ -275,7 +275,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { * @since v1-alpha10 */ @Throws(IOAccessException::class) - fun writeNextByteTo(stream: FileStream): FileStream { + fun writeNextByteTo(stream: Stream): Stream { val byte: Byte? = readNextByte() if (byte != null) @@ -286,8 +286,8 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { /** * Reads the next [n] byte of this - * [FileStream] and writes it - * to the specified [FileStream]. + * [Stream] and writes it + * to the specified [Stream]. * * @param stream stream to write to * @return this instance @@ -295,16 +295,16 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { * @since v1-alpha10 */ @Throws(IOAccessException::class) - fun writeNBytesTo(stream: FileStream, n: UInt): FileStream { + fun writeNBytesTo(stream: Stream, n: UInt): Stream { stream.writeBytes(readNBytes(n)) return this } /** * Reads all bytes of this - * [FileStream] and writes + * [Stream] and writes * them to the specified - * [FileStream]. + * [Stream]. * * @param stream stream to write to * @return this instance @@ -312,7 +312,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { * @since v1-alpha10 */ @Throws(IOAccessException::class) - fun writeRemainingBytesTo(stream: FileStream): FileStream { + fun writeRemainingBytesTo(stream: Stream): Stream { stream.writeBytes(readRemainingBytes()) return this } @@ -351,13 +351,13 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { // -----> Inner classes /** * Represents the mode in which - * [FileStream]s can operate in. + * [Stream]s can operate in. * * @since v1-alpha10 */ enum class StreamMode { /** - * A [FileStream] which only + * A [Stream] which only * supports reading. * * @since v1-alpha10 @@ -365,7 +365,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { READ, /** - * A [FileStream] which only + * A [Stream] which only * supports writing. * * @since v1-alpha10 @@ -373,7 +373,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { WRITE, /** - * A [FileStream] which supports + * A [Stream] which supports * both reading and writing. * * @since v1-alpha10 @@ -383,15 +383,15 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { /** * An implementation of Java - * [InputStream]s for [FileStream]s. + * [InputStream]s for [Stream]s. * - * @param fileStream [FileStream] to use + * @param stream [Stream] to use * @throws IOException on IO error * @since v1-alpha10 */ class InputFileStream @NonKotlinContact - internal constructor(val fileStream: FileStream) + internal constructor(val stream: Stream) : InputStream() { /** * Reads the next byte. @@ -402,7 +402,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { */ @Throws(IOException::class) override fun read(): Int = try { - fileStream.readNextByte()?.toInt() ?: -1 + stream.readNextByte()?.toInt() ?: -1 } catch (exception: IOAccessException) { throw IOException("Failed reading the next byte", exception) } @@ -410,15 +410,15 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { /** * An implementation of Java - * [OutputStream]s for [FileStream]s. + * [OutputStream]s for [Stream]s. * - * @param fileStream [FileStream] to use + * @param stream [Stream] to use * @since v1-alpha10 */ @NonKotlinContact class OutputFileStream @NonKotlinContact - internal constructor(val fileStream: FileStream) + internal constructor(val stream: Stream) : OutputStream() { /** * Writes (or rather: appends) a byte. @@ -430,7 +430,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable { @Throws(IOException::class) override fun write(byte: Int) { try { - fileStream.writeByte(byte.toByte()) + stream.writeByte(byte.toByte()) } catch (exception: IOAccessException) { throw IOException("Failed writing the next byte", exception) } diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/WriteFileStream.kt b/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/WriteStream.kt similarity index 91% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/WriteFileStream.kt rename to base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/WriteStream.kt index 01392c524..454772491 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/WriteFileStream.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/WriteStream.kt @@ -20,11 +20,11 @@ package de.staropensource.engine.base.implementable.stream /** - * A write-only [FileStream]. + * A write-only [Stream]. * * @since v1-alpha10 */ -abstract class WriteFileStream : FileStream(streamMode = StreamMode.WRITE) { +abstract class WriteStream : Stream(streamMode = StreamMode.WRITE) { override fun remaining(): Boolean = false override fun available(): UInt = 0u override fun readNextByte(): Byte? = 0x00 diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/package-info.kt b/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/package-info.kt index 2591b87cb..47851c24d 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/package-info.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/package-info.kt @@ -18,7 +18,7 @@ */ /** - * Streams. Particularly [FileStream]s. + * [Streams]. * * @since v1-alpha10 */ diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteReadFileStream.kt b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteReadStream.kt similarity index 90% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteReadFileStream.kt rename to base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteReadStream.kt index b4004031c..bc2f41fe0 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteReadFileStream.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteReadStream.kt @@ -20,18 +20,18 @@ package de.staropensource.engine.base.implementation.stream import de.staropensource.engine.base.exception.io.StreamClosedException -import de.staropensource.engine.base.implementable.stream.FileStream -import de.staropensource.engine.base.implementable.stream.ReadFileStream +import de.staropensource.engine.base.implementable.stream.Stream +import de.staropensource.engine.base.implementable.stream.ReadStream import java.io.ByteArrayInputStream /** - * A [FileStream] which can + * A [Stream] which can * only read [Byte]s. * * @param bytesRead [ByteArray] to provide for reading * @since v1-alpha10 */ -open class ByteReadFileStream(val bytesRead: ByteArray) : ReadFileStream() { +open class ByteReadStream(val bytesRead: ByteArray) : ReadStream() { /** * Contains the [ByteArrayInputStream] * for the supplied [bytesRead] property. diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteFileStream.kt b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteStream.kt similarity index 89% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteFileStream.kt rename to base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteStream.kt index 8d869fa49..7f577ad9e 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteFileStream.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteStream.kt @@ -20,17 +20,17 @@ package de.staropensource.engine.base.implementation.stream import de.staropensource.engine.base.exception.io.StreamClosedException -import de.staropensource.engine.base.implementable.stream.FileStream +import de.staropensource.engine.base.implementable.stream.Stream import java.io.ByteArrayInputStream /** - * A [FileStream] which can + * A [Stream] which can * read and write [Byte]s. * * @param bytesRead [ByteArray] to provide for reading * @since v1-alpha10 */ -open class ByteFileStream(val bytesRead: ByteArray) : FileStream(streamMode = StreamMode.READ_WRITE) { +open class ByteStream(val bytesRead: ByteArray) : Stream(streamMode = StreamMode.READ_WRITE) { /** * Contains the [ByteArrayInputStream] * for the supplied [bytesRead] property. @@ -56,7 +56,7 @@ open class ByteFileStream(val bytesRead: ByteArray) : FileStream(streamMode = St // -----> Writing - override fun writeByte(byte: Byte): FileStream { + override fun writeByte(byte: Byte): Stream { if (closed) throw StreamClosedException(this) @@ -64,7 +64,7 @@ open class ByteFileStream(val bytesRead: ByteArray) : FileStream(streamMode = St return this } - override fun writeBytes(bytes: ByteArray): FileStream { + override fun writeBytes(bytes: ByteArray): Stream { if (closed) throw StreamClosedException(this) diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteWriteFileStream.kt b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteWriteStream.kt similarity index 82% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteWriteFileStream.kt rename to base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteWriteStream.kt index ab89c55ff..104776fc8 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteWriteFileStream.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteWriteStream.kt @@ -20,16 +20,16 @@ package de.staropensource.engine.base.implementation.stream import de.staropensource.engine.base.exception.io.StreamClosedException -import de.staropensource.engine.base.implementable.stream.FileStream -import de.staropensource.engine.base.implementable.stream.WriteFileStream +import de.staropensource.engine.base.implementable.stream.Stream +import de.staropensource.engine.base.implementable.stream.WriteStream /** - * A [FileStream] which can + * A [Stream] which can * only write [Byte]s. * * @since v1-alpha10 */ -open class ByteWriteFileStream : WriteFileStream() { +open class ByteWriteStream : WriteStream() { /** * Contains the bytes written * to this stream. @@ -45,7 +45,7 @@ open class ByteWriteFileStream : WriteFileStream() { // -----> Writing - override fun writeByte(byte: Byte): FileStream { + override fun writeByte(byte: Byte): Stream { if (closed) throw StreamClosedException(this) @@ -53,7 +53,7 @@ open class ByteWriteFileStream : WriteFileStream() { return this } - override fun writeBytes(bytes: ByteArray): FileStream { + override fun writeBytes(bytes: ByteArray): Stream { if (closed) throw StreamClosedException(this) diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/FileAccessStream.kt b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/FileAccessStream.kt index e717cacc2..c9db190d4 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/FileAccessStream.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/FileAccessStream.kt @@ -22,12 +22,12 @@ package de.staropensource.engine.base.implementation.stream import de.staropensource.engine.base.exception.VerificationFailedException import de.staropensource.engine.base.exception.io.IOAccessException import de.staropensource.engine.base.exception.io.StreamClosedException -import de.staropensource.engine.base.implementable.stream.FileStream +import de.staropensource.engine.base.implementable.stream.Stream import de.staropensource.engine.base.utility.FileAccess import java.io.InputStream /** - * A [FileStream] used exclusively for + * A [Stream] used exclusively for * accessing files via the [FileAccess] * API. * @@ -35,7 +35,7 @@ import java.io.InputStream * @see FileAccess.toStream * @since v1-alpha10 */ -class FileAccessStream internal constructor(val file: FileAccess) : FileStream(streamMode = StreamMode.READ_WRITE) { +class FileAccessStream internal constructor(val file: FileAccess) : Stream(streamMode = StreamMode.READ_WRITE) { // -----> Metadata /** * Contains the [InputStream] used @@ -53,9 +53,9 @@ class FileAccessStream internal constructor(val file: FileAccess) : FileStream(s // -----> Writing - override fun writeByte(byte: Byte): FileStream = writeBytes(byteArrayOf(byte)) + override fun writeByte(byte: Byte): Stream = writeBytes(byteArrayOf(byte)) - override fun writeBytes(bytes: ByteArray): FileStream { + override fun writeBytes(bytes: ByteArray): Stream { if (closed) throw StreamClosedException(this) diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/LoggerFileStream.kt b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/LoggerStream.kt similarity index 85% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/LoggerFileStream.kt rename to base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/LoggerStream.kt index 1b4d876d4..505335b1c 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/LoggerFileStream.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/LoggerStream.kt @@ -19,14 +19,14 @@ package de.staropensource.engine.base.implementation.stream -import de.staropensource.engine.base.implementable.stream.FileStream -import de.staropensource.engine.base.implementable.stream.WriteFileStream +import de.staropensource.engine.base.implementable.stream.Stream +import de.staropensource.engine.base.implementable.stream.WriteStream import de.staropensource.engine.base.logging.Logger import de.staropensource.engine.base.type.logging.Level import de.staropensource.engine.base.utility.FileAccess /** - * A [FileStream] used exclusively + * A [Stream] used exclusively * for printing log messages. * * A log message is only printed @@ -36,7 +36,7 @@ import de.staropensource.engine.base.utility.FileAccess * @see FileAccess.toStream * @since v1-alpha10 */ -class LoggerFileStream internal constructor(val logger: Logger, val level: Level) : WriteFileStream() { +class LoggerStream internal constructor(val logger: Logger, val level: Level) : WriteStream() { /** * Contains the current line. * @@ -48,9 +48,9 @@ class LoggerFileStream internal constructor(val logger: Logger, val level: Level logger.stream.remove(level) } - override fun writeByte(byte: Byte): FileStream = writeBytes(byteArrayOf(byte)) + override fun writeByte(byte: Byte): Stream = writeBytes(byteArrayOf(byte)) - override fun writeBytes(bytes: ByteArray): FileStream { + override fun writeBytes(bytes: ByteArray): Stream { line.append(bytes.decodeToString()) checkAndPrint() diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/NullFileStream.kt b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/NullStream.kt similarity index 74% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/NullFileStream.kt rename to base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/NullStream.kt index 742d35dd7..52bfd0629 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/NullFileStream.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/NullStream.kt @@ -19,33 +19,33 @@ package de.staropensource.engine.base.implementation.stream -import de.staropensource.engine.base.implementable.stream.FileStream +import de.staropensource.engine.base.implementable.stream.Stream /** - * A [FileStream] which does nothing. + * A [Stream] which does nothing. * * @since v1-alpha10 */ -class NullFileStream private constructor() : FileStream(streamMode = StreamMode.READ_WRITE) { +class NullStream private constructor() : Stream(streamMode = StreamMode.READ_WRITE) { /** - * Companion object of [NullFileStream]. + * Companion object of [NullStream]. * * @since v1-alpha10 */ companion object { /** - * Global instance of [NullFileStream]. + * Global instance of [NullStream]. * * @since v1-alpha10 */ @JvmStatic - val instance: NullFileStream = NullFileStream() + val instance: NullStream = NullStream() } override fun closeStream() = Unit - override fun writeByte(byte: Byte): FileStream = this - override fun writeBytes(bytes: ByteArray): FileStream = this + override fun writeByte(byte: Byte): Stream = this + override fun writeBytes(bytes: ByteArray): Stream = this override fun remaining(): Boolean = true override fun available(): UInt = 0u diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringReadFileStream.kt b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringReadStream.kt similarity index 82% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringReadFileStream.kt rename to base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringReadStream.kt index d8b931cab..06c0ad239 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringReadFileStream.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringReadStream.kt @@ -19,13 +19,13 @@ package de.staropensource.engine.base.implementation.stream -import de.staropensource.engine.base.implementable.stream.FileStream +import de.staropensource.engine.base.implementable.stream.Stream /** - * A [FileStream] which can + * A [Stream] which can * only read strings. * * @param stringRead string to provide for reading * @since v1-alpha10 */ -open class StringReadFileStream(val stringRead: String) : ByteReadFileStream(bytesRead = stringRead.toByteArray()) +open class StringReadStream(val stringRead: String) : ByteReadStream(bytesRead = stringRead.toByteArray()) diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringFileStream.kt b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringStream.kt similarity index 84% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringFileStream.kt rename to base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringStream.kt index 83f2b4acc..19df8d17d 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringFileStream.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringStream.kt @@ -19,16 +19,16 @@ package de.staropensource.engine.base.implementation.stream -import de.staropensource.engine.base.implementable.stream.FileStream +import de.staropensource.engine.base.implementable.stream.Stream /** - * A [FileStream] which can + * A [Stream] which can * read and write strings. * * @param stringRead string to provide for reading * @since v1-alpha10 */ -open class StringFileStream(val stringRead: String) : ByteFileStream(bytesRead = stringRead.toByteArray()) { +open class StringStream(val stringRead: String) : ByteStream(bytesRead = stringRead.toByteArray()) { /** * Returns the written string. * diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringWriteFileStream.kt b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringWriteStream.kt similarity index 87% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringWriteFileStream.kt rename to base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringWriteStream.kt index 792ce5b62..5f6a243f2 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringWriteFileStream.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringWriteStream.kt @@ -19,15 +19,15 @@ package de.staropensource.engine.base.implementation.stream -import de.staropensource.engine.base.implementable.stream.FileStream +import de.staropensource.engine.base.implementable.stream.Stream /** - * A [FileStream] which can + * A [Stream] which can * only write strings. * * @since v1-alpha10 */ -open class StringWriteFileStream : ByteWriteFileStream() { +open class StringWriteStream : ByteWriteStream() { /** * Returns the written string. * diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/package-info.kt b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/package-info.kt index 64220784f..9c6a4fa5d 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/package-info.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/package-info.kt @@ -18,10 +18,10 @@ */ /** - * Implementations of [FileStream] far and wide. + * Implementations of [Stream] far and wide. * * @since v1-alpha10 */ package de.staropensource.engine.base.implementation.stream -import de.staropensource.engine.base.implementable.stream.FileStream +import de.staropensource.engine.base.implementable.stream.Stream diff --git a/base/src/main/kotlin/de/staropensource/engine/base/logging/Logger.kt b/base/src/main/kotlin/de/staropensource/engine/base/logging/Logger.kt index 6dc88faf3..672f8ac34 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/logging/Logger.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/logging/Logger.kt @@ -22,9 +22,9 @@ package de.staropensource.engine.base.logging import de.staropensource.engine.base.EngineConfiguration import de.staropensource.engine.base.annotation.NonKotlinContact import de.staropensource.engine.base.implementable.logging.LoggerThreadingHandler -import de.staropensource.engine.base.implementable.stream.FileStream +import de.staropensource.engine.base.implementable.stream.Stream import de.staropensource.engine.base.implementation.stream.FileAccessStream -import de.staropensource.engine.base.implementation.stream.LoggerFileStream +import de.staropensource.engine.base.implementation.stream.LoggerStream import de.staropensource.engine.base.type.logging.Call import de.staropensource.engine.base.type.logging.Level import de.staropensource.engine.base.utility.misc.StackTraceUtils @@ -81,11 +81,11 @@ class Logger { private val channel: String /** - * Contains the [LoggerFileStream] for this instance. + * Contains the [LoggerStream] for this instance. * * @since v1-alpha10 */ - internal val stream: MutableMap = mutableMapOf() + internal val stream: MutableMap = mutableMapOf() @NonKotlinContact @JvmName(name = "getActualStream") get @@ -233,13 +233,13 @@ class Logger { } /** - * Returns a [FileStream] for + * Returns a [Stream] for * writing to the specified * [Level] using this instance. * - * @param level [Level] to which the [FileStream] shall log to + * @param level [Level] to which the [Stream] shall log to * @return [FileAccessStream] instance * @since v1-alpha10 */ - fun toStream(level: Level): LoggerFileStream = stream.computeIfAbsent(level) { level -> LoggerFileStream(this, level) } + fun toStream(level: Level): LoggerStream = stream.computeIfAbsent(level) { level -> LoggerStream(this, level) } } diff --git a/base/src/main/kotlin/de/staropensource/engine/base/utility/FileAccess.kt b/base/src/main/kotlin/de/staropensource/engine/base/utility/FileAccess.kt index 66a2d66d8..5807f6452 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/utility/FileAccess.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/utility/FileAccess.kt @@ -25,7 +25,7 @@ import de.staropensource.engine.base.exception.io.FileOrDirectoryNotFoundExcepti import de.staropensource.engine.base.exception.io.FileTooLargeException import de.staropensource.engine.base.exception.io.IOAccessException import de.staropensource.engine.base.exception.VerificationFailedException -import de.staropensource.engine.base.implementable.stream.FileStream +import de.staropensource.engine.base.implementable.stream.Stream import de.staropensource.engine.base.implementation.stream.FileAccessStream import de.staropensource.engine.base.utility.Environment.OperatingSystem.* import de.staropensource.engine.base.utility.FileAccess.Companion.configDirectory @@ -570,7 +570,7 @@ class FileAccess { // -----> Streams getters /** - * Returns a [FileStream] for reading + * Returns a [Stream] for reading * and writing from and to this file. * * @return [FileAccessStream] instance