Rename file streams to just streams

This commit is contained in:
JeremyStar™ 2024-12-24 03:25:20 +01:00
parent 046ccea7b1
commit b133f7e3a7
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
17 changed files with 102 additions and 102 deletions

View file

@ -19,14 +19,14 @@
package de.staropensource.engine.base.exception.io 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 * Thrown when trying to
* access a closed [FileStream]. * access a closed [Stream].
* *
* @see FileStream * @see Stream
* @see FileStream.closed * @see Stream.closed
* @since v1-alpha10 * @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")

View file

@ -20,11 +20,11 @@
package de.staropensource.engine.base.implementable.stream package de.staropensource.engine.base.implementable.stream
/** /**
* A read-only [FileStream]. * A read-only [Stream].
* *
* @since v1-alpha10 * @since v1-alpha10
*/ */
abstract class ReadFileStream : FileStream(streamMode = StreamMode.READ) { abstract class ReadStream : Stream(streamMode = StreamMode.READ) {
override fun writeByte(byte: Byte): FileStream = this override fun writeByte(byte: Byte): Stream = this
override fun writeBytes(bytes: ByteArray): FileStream = this override fun writeBytes(bytes: ByteArray): Stream = this
} }

View file

@ -21,7 +21,7 @@ package de.staropensource.engine.base.implementable.stream
import de.staropensource.engine.base.annotation.NonKotlinContact import de.staropensource.engine.base.annotation.NonKotlinContact
import de.staropensource.engine.base.exception.io.IOAccessException 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.IOException
import java.io.InputStream import java.io.InputStream
import java.io.OutputStream import java.io.OutputStream
@ -32,19 +32,19 @@ import java.io.OutputStream
* @param streamMode supported [StreamMode]s * @param streamMode supported [StreamMode]s
* @since v1-alpha10 * @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 * @since v1-alpha10
*/ */
companion object { companion object {
/** /**
* Returns a [FileStream] which does nothing. * Returns a [Stream] which does nothing.
* *
* @since v1-alpha10 * @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] * Contains the [java.io.InputStream]
* for this [FileStream] instance. * for this [Stream] instance.
* *
* @since v1-alpha10 * @since v1-alpha10
*/ */
@ -67,7 +67,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
/** /**
* Contains the [java.io.OutputStream] * Contains the [java.io.OutputStream]
* for this [FileStream] instance. * for this [Stream] instance.
* *
* @since v1-alpha10 * @since v1-alpha10
*/ */
@ -112,7 +112,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
* for a single byte, just add this * for a single byte, just add this
* line to your implementation instead: * line to your implementation instead:
* ```kotlin * ```kotlin
* override fun writeByte(byte: Byte): FileStream = writeBytes(byteArrayOf(byte)) * override fun writeByte(byte: Byte): Stream = writeBytes(byteArrayOf(byte))
* ``` * ```
* *
* @param byte [Byte] to write * @param byte [Byte] to write
@ -121,7 +121,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
* @since v1-alpha10 * @since v1-alpha10
*/ */
@Throws(IOAccessException::class) @Throws(IOAccessException::class)
abstract fun writeByte(byte: Byte): FileStream abstract fun writeByte(byte: Byte): Stream
/** /**
* Writes (or rather: appends) * Writes (or rather: appends)
@ -133,7 +133,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
* @since v1-alpha10 * @since v1-alpha10
*/ */
@Throws(IOAccessException::class) @Throws(IOAccessException::class)
abstract fun writeBytes(bytes: ByteArray): FileStream abstract fun writeBytes(bytes: ByteArray): Stream
/** /**
* Writes (or rather: appends) * Writes (or rather: appends)
@ -145,7 +145,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
* @since v1-alpha10 * @since v1-alpha10
*/ */
@Throws(IOAccessException::class) @Throws(IOAccessException::class)
fun writeString(string: String): FileStream = writeBytes(string.toByteArray()) fun writeString(string: String): Stream = writeBytes(string.toByteArray())
/** /**
* Writes (or rather: appends) * Writes (or rather: appends)
@ -157,7 +157,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
* @since v1-alpha10 * @since v1-alpha10
*/ */
@Throws(IOAccessException::class) @Throws(IOAccessException::class)
fun write(value: Any): FileStream = writeBytes(value.toString().toByteArray()) fun write(value: Any): Stream = writeBytes(value.toString().toByteArray())
// -----> Reading // -----> Reading
@ -230,7 +230,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
* @since v1-alpha10 * @since v1-alpha10
*/ */
@Throws(IOAccessException::class) @Throws(IOAccessException::class)
fun skipNextByte(): FileStream { fun skipNextByte(): Stream {
readNextByte() readNextByte()
return this return this
} }
@ -244,7 +244,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
* @since v1-alpha10 * @since v1-alpha10
*/ */
@Throws(IOAccessException::class) @Throws(IOAccessException::class)
fun skipNBytes(n: UInt): FileStream { fun skipNBytes(n: UInt): Stream {
readNBytes(n) readNBytes(n)
return this return this
} }
@ -257,7 +257,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
* @since v1-alpha10 * @since v1-alpha10
*/ */
@Throws(IOAccessException::class) @Throws(IOAccessException::class)
fun skipRemainingBytes(): FileStream { fun skipRemainingBytes(): Stream {
readRemainingBytes() readRemainingBytes()
return this return this
} }
@ -266,8 +266,8 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
// -----> Redirection // -----> Redirection
/** /**
* Reads the next byte of this * Reads the next byte of this
* [FileStream] and writes it * [Stream] and writes it
* to the specified [FileStream]. * to the specified [Stream].
* *
* @param stream stream to write to * @param stream stream to write to
* @return this instance * @return this instance
@ -275,7 +275,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
* @since v1-alpha10 * @since v1-alpha10
*/ */
@Throws(IOAccessException::class) @Throws(IOAccessException::class)
fun writeNextByteTo(stream: FileStream): FileStream { fun writeNextByteTo(stream: Stream): Stream {
val byte: Byte? = readNextByte() val byte: Byte? = readNextByte()
if (byte != null) if (byte != null)
@ -286,8 +286,8 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
/** /**
* Reads the next [n] byte of this * Reads the next [n] byte of this
* [FileStream] and writes it * [Stream] and writes it
* to the specified [FileStream]. * to the specified [Stream].
* *
* @param stream stream to write to * @param stream stream to write to
* @return this instance * @return this instance
@ -295,16 +295,16 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
* @since v1-alpha10 * @since v1-alpha10
*/ */
@Throws(IOAccessException::class) @Throws(IOAccessException::class)
fun writeNBytesTo(stream: FileStream, n: UInt): FileStream { fun writeNBytesTo(stream: Stream, n: UInt): Stream {
stream.writeBytes(readNBytes(n)) stream.writeBytes(readNBytes(n))
return this return this
} }
/** /**
* Reads all bytes of this * Reads all bytes of this
* [FileStream] and writes * [Stream] and writes
* them to the specified * them to the specified
* [FileStream]. * [Stream].
* *
* @param stream stream to write to * @param stream stream to write to
* @return this instance * @return this instance
@ -312,7 +312,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
* @since v1-alpha10 * @since v1-alpha10
*/ */
@Throws(IOAccessException::class) @Throws(IOAccessException::class)
fun writeRemainingBytesTo(stream: FileStream): FileStream { fun writeRemainingBytesTo(stream: Stream): Stream {
stream.writeBytes(readRemainingBytes()) stream.writeBytes(readRemainingBytes())
return this return this
} }
@ -351,13 +351,13 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
// -----> Inner classes // -----> Inner classes
/** /**
* Represents the mode in which * Represents the mode in which
* [FileStream]s can operate in. * [Stream]s can operate in.
* *
* @since v1-alpha10 * @since v1-alpha10
*/ */
enum class StreamMode { enum class StreamMode {
/** /**
* A [FileStream] which only * A [Stream] which only
* supports reading. * supports reading.
* *
* @since v1-alpha10 * @since v1-alpha10
@ -365,7 +365,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
READ, READ,
/** /**
* A [FileStream] which only * A [Stream] which only
* supports writing. * supports writing.
* *
* @since v1-alpha10 * @since v1-alpha10
@ -373,7 +373,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
WRITE, WRITE,
/** /**
* A [FileStream] which supports * A [Stream] which supports
* both reading and writing. * both reading and writing.
* *
* @since v1-alpha10 * @since v1-alpha10
@ -383,15 +383,15 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
/** /**
* An implementation of Java * 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 * @throws IOException on IO error
* @since v1-alpha10 * @since v1-alpha10
*/ */
class InputFileStream class InputFileStream
@NonKotlinContact @NonKotlinContact
internal constructor(val fileStream: FileStream) internal constructor(val stream: Stream)
: InputStream() { : InputStream() {
/** /**
* Reads the next byte. * Reads the next byte.
@ -402,7 +402,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
*/ */
@Throws(IOException::class) @Throws(IOException::class)
override fun read(): Int = try { override fun read(): Int = try {
fileStream.readNextByte()?.toInt() ?: -1 stream.readNextByte()?.toInt() ?: -1
} catch (exception: IOAccessException) { } catch (exception: IOAccessException) {
throw IOException("Failed reading the next byte", exception) throw IOException("Failed reading the next byte", exception)
} }
@ -410,15 +410,15 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
/** /**
* An implementation of Java * 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 * @since v1-alpha10
*/ */
@NonKotlinContact @NonKotlinContact
class OutputFileStream class OutputFileStream
@NonKotlinContact @NonKotlinContact
internal constructor(val fileStream: FileStream) internal constructor(val stream: Stream)
: OutputStream() { : OutputStream() {
/** /**
* Writes (or rather: appends) a byte. * Writes (or rather: appends) a byte.
@ -430,7 +430,7 @@ abstract class FileStream(val streamMode: StreamMode) : AutoCloseable {
@Throws(IOException::class) @Throws(IOException::class)
override fun write(byte: Int) { override fun write(byte: Int) {
try { try {
fileStream.writeByte(byte.toByte()) stream.writeByte(byte.toByte())
} catch (exception: IOAccessException) { } catch (exception: IOAccessException) {
throw IOException("Failed writing the next byte", exception) throw IOException("Failed writing the next byte", exception)
} }

View file

@ -20,11 +20,11 @@
package de.staropensource.engine.base.implementable.stream package de.staropensource.engine.base.implementable.stream
/** /**
* A write-only [FileStream]. * A write-only [Stream].
* *
* @since v1-alpha10 * @since v1-alpha10
*/ */
abstract class WriteFileStream : FileStream(streamMode = StreamMode.WRITE) { abstract class WriteStream : Stream(streamMode = StreamMode.WRITE) {
override fun remaining(): Boolean = false override fun remaining(): Boolean = false
override fun available(): UInt = 0u override fun available(): UInt = 0u
override fun readNextByte(): Byte? = 0x00 override fun readNextByte(): Byte? = 0x00

View file

@ -18,7 +18,7 @@
*/ */
/** /**
* Streams. Particularly [FileStream]s. * [Streams].
* *
* @since v1-alpha10 * @since v1-alpha10
*/ */

View file

@ -20,18 +20,18 @@
package de.staropensource.engine.base.implementation.stream package de.staropensource.engine.base.implementation.stream
import de.staropensource.engine.base.exception.io.StreamClosedException 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.implementable.stream.ReadFileStream import de.staropensource.engine.base.implementable.stream.ReadStream
import java.io.ByteArrayInputStream import java.io.ByteArrayInputStream
/** /**
* A [FileStream] which can * A [Stream] which can
* only read [Byte]s. * only read [Byte]s.
* *
* @param bytesRead [ByteArray] to provide for reading * @param bytesRead [ByteArray] to provide for reading
* @since v1-alpha10 * @since v1-alpha10
*/ */
open class ByteReadFileStream(val bytesRead: ByteArray) : ReadFileStream() { open class ByteReadStream(val bytesRead: ByteArray) : ReadStream() {
/** /**
* Contains the [ByteArrayInputStream] * Contains the [ByteArrayInputStream]
* for the supplied [bytesRead] property. * for the supplied [bytesRead] property.

View file

@ -20,17 +20,17 @@
package de.staropensource.engine.base.implementation.stream package de.staropensource.engine.base.implementation.stream
import de.staropensource.engine.base.exception.io.StreamClosedException 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 import java.io.ByteArrayInputStream
/** /**
* A [FileStream] which can * A [Stream] which can
* read and write [Byte]s. * read and write [Byte]s.
* *
* @param bytesRead [ByteArray] to provide for reading * @param bytesRead [ByteArray] to provide for reading
* @since v1-alpha10 * @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] * Contains the [ByteArrayInputStream]
* for the supplied [bytesRead] property. * for the supplied [bytesRead] property.
@ -56,7 +56,7 @@ open class ByteFileStream(val bytesRead: ByteArray) : FileStream(streamMode = St
// -----> Writing // -----> Writing
override fun writeByte(byte: Byte): FileStream { override fun writeByte(byte: Byte): Stream {
if (closed) if (closed)
throw StreamClosedException(this) throw StreamClosedException(this)
@ -64,7 +64,7 @@ open class ByteFileStream(val bytesRead: ByteArray) : FileStream(streamMode = St
return this return this
} }
override fun writeBytes(bytes: ByteArray): FileStream { override fun writeBytes(bytes: ByteArray): Stream {
if (closed) if (closed)
throw StreamClosedException(this) throw StreamClosedException(this)

View file

@ -20,16 +20,16 @@
package de.staropensource.engine.base.implementation.stream package de.staropensource.engine.base.implementation.stream
import de.staropensource.engine.base.exception.io.StreamClosedException 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.implementable.stream.WriteFileStream import de.staropensource.engine.base.implementable.stream.WriteStream
/** /**
* A [FileStream] which can * A [Stream] which can
* only write [Byte]s. * only write [Byte]s.
* *
* @since v1-alpha10 * @since v1-alpha10
*/ */
open class ByteWriteFileStream : WriteFileStream() { open class ByteWriteStream : WriteStream() {
/** /**
* Contains the bytes written * Contains the bytes written
* to this stream. * to this stream.
@ -45,7 +45,7 @@ open class ByteWriteFileStream : WriteFileStream() {
// -----> Writing // -----> Writing
override fun writeByte(byte: Byte): FileStream { override fun writeByte(byte: Byte): Stream {
if (closed) if (closed)
throw StreamClosedException(this) throw StreamClosedException(this)
@ -53,7 +53,7 @@ open class ByteWriteFileStream : WriteFileStream() {
return this return this
} }
override fun writeBytes(bytes: ByteArray): FileStream { override fun writeBytes(bytes: ByteArray): Stream {
if (closed) if (closed)
throw StreamClosedException(this) throw StreamClosedException(this)

View file

@ -22,12 +22,12 @@ package de.staropensource.engine.base.implementation.stream
import de.staropensource.engine.base.exception.VerificationFailedException import de.staropensource.engine.base.exception.VerificationFailedException
import de.staropensource.engine.base.exception.io.IOAccessException import de.staropensource.engine.base.exception.io.IOAccessException
import de.staropensource.engine.base.exception.io.StreamClosedException 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 de.staropensource.engine.base.utility.FileAccess
import java.io.InputStream import java.io.InputStream
/** /**
* A [FileStream] used exclusively for * A [Stream] used exclusively for
* accessing files via the [FileAccess] * accessing files via the [FileAccess]
* API. * API.
* *
@ -35,7 +35,7 @@ import java.io.InputStream
* @see FileAccess.toStream * @see FileAccess.toStream
* @since v1-alpha10 * @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 // -----> Metadata
/** /**
* Contains the [InputStream] used * Contains the [InputStream] used
@ -53,9 +53,9 @@ class FileAccessStream internal constructor(val file: FileAccess) : FileStream(s
// -----> Writing // -----> 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) if (closed)
throw StreamClosedException(this) throw StreamClosedException(this)

View file

@ -19,14 +19,14 @@
package de.staropensource.engine.base.implementation.stream package de.staropensource.engine.base.implementation.stream
import de.staropensource.engine.base.implementable.stream.FileStream import de.staropensource.engine.base.implementable.stream.Stream
import de.staropensource.engine.base.implementable.stream.WriteFileStream import de.staropensource.engine.base.implementable.stream.WriteStream
import de.staropensource.engine.base.logging.Logger import de.staropensource.engine.base.logging.Logger
import de.staropensource.engine.base.type.logging.Level import de.staropensource.engine.base.type.logging.Level
import de.staropensource.engine.base.utility.FileAccess import de.staropensource.engine.base.utility.FileAccess
/** /**
* A [FileStream] used exclusively * A [Stream] used exclusively
* for printing log messages. * for printing log messages.
* *
* A log message is only printed * A log message is only printed
@ -36,7 +36,7 @@ import de.staropensource.engine.base.utility.FileAccess
* @see FileAccess.toStream * @see FileAccess.toStream
* @since v1-alpha10 * @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. * Contains the current line.
* *
@ -48,9 +48,9 @@ class LoggerFileStream internal constructor(val logger: Logger, val level: Level
logger.stream.remove(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()) line.append(bytes.decodeToString())
checkAndPrint() checkAndPrint()

View file

@ -19,33 +19,33 @@
package de.staropensource.engine.base.implementation.stream 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 * @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 * @since v1-alpha10
*/ */
companion object { companion object {
/** /**
* Global instance of [NullFileStream]. * Global instance of [NullStream].
* *
* @since v1-alpha10 * @since v1-alpha10
*/ */
@JvmStatic @JvmStatic
val instance: NullFileStream = NullFileStream() val instance: NullStream = NullStream()
} }
override fun closeStream() = Unit override fun closeStream() = Unit
override fun writeByte(byte: Byte): FileStream = this override fun writeByte(byte: Byte): Stream = this
override fun writeBytes(bytes: ByteArray): FileStream = this override fun writeBytes(bytes: ByteArray): Stream = this
override fun remaining(): Boolean = true override fun remaining(): Boolean = true
override fun available(): UInt = 0u override fun available(): UInt = 0u

View file

@ -19,13 +19,13 @@
package de.staropensource.engine.base.implementation.stream 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. * only read strings.
* *
* @param stringRead string to provide for reading * @param stringRead string to provide for reading
* @since v1-alpha10 * @since v1-alpha10
*/ */
open class StringReadFileStream(val stringRead: String) : ByteReadFileStream(bytesRead = stringRead.toByteArray()) open class StringReadStream(val stringRead: String) : ByteReadStream(bytesRead = stringRead.toByteArray())

View file

@ -19,16 +19,16 @@
package de.staropensource.engine.base.implementation.stream 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. * read and write strings.
* *
* @param stringRead string to provide for reading * @param stringRead string to provide for reading
* @since v1-alpha10 * @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. * Returns the written string.
* *

View file

@ -19,15 +19,15 @@
package de.staropensource.engine.base.implementation.stream 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. * only write strings.
* *
* @since v1-alpha10 * @since v1-alpha10
*/ */
open class StringWriteFileStream : ByteWriteFileStream() { open class StringWriteStream : ByteWriteStream() {
/** /**
* Returns the written string. * Returns the written string.
* *

View file

@ -18,10 +18,10 @@
*/ */
/** /**
* Implementations of [FileStream] far and wide. * Implementations of [Stream] far and wide.
* *
* @since v1-alpha10 * @since v1-alpha10
*/ */
package de.staropensource.engine.base.implementation.stream package de.staropensource.engine.base.implementation.stream
import de.staropensource.engine.base.implementable.stream.FileStream import de.staropensource.engine.base.implementable.stream.Stream

View file

@ -22,9 +22,9 @@ package de.staropensource.engine.base.logging
import de.staropensource.engine.base.EngineConfiguration import de.staropensource.engine.base.EngineConfiguration
import de.staropensource.engine.base.annotation.NonKotlinContact import de.staropensource.engine.base.annotation.NonKotlinContact
import de.staropensource.engine.base.implementable.logging.LoggerThreadingHandler 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.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.Call
import de.staropensource.engine.base.type.logging.Level import de.staropensource.engine.base.type.logging.Level
import de.staropensource.engine.base.utility.misc.StackTraceUtils import de.staropensource.engine.base.utility.misc.StackTraceUtils
@ -81,11 +81,11 @@ class Logger {
private val channel: String private val channel: String
/** /**
* Contains the [LoggerFileStream] for this instance. * Contains the [LoggerStream] for this instance.
* *
* @since v1-alpha10 * @since v1-alpha10
*/ */
internal val stream: MutableMap<Level, LoggerFileStream> = mutableMapOf() internal val stream: MutableMap<Level, LoggerStream> = mutableMapOf()
@NonKotlinContact @NonKotlinContact
@JvmName(name = "getActualStream") get @JvmName(name = "getActualStream") get
@ -233,13 +233,13 @@ class Logger {
} }
/** /**
* Returns a [FileStream] for * Returns a [Stream] for
* writing to the specified * writing to the specified
* [Level] using this instance. * [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 * @return [FileAccessStream] instance
* @since v1-alpha10 * @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) }
} }

View file

@ -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.FileTooLargeException
import de.staropensource.engine.base.exception.io.IOAccessException import de.staropensource.engine.base.exception.io.IOAccessException
import de.staropensource.engine.base.exception.VerificationFailedException 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.implementation.stream.FileAccessStream
import de.staropensource.engine.base.utility.Environment.OperatingSystem.* import de.staropensource.engine.base.utility.Environment.OperatingSystem.*
import de.staropensource.engine.base.utility.FileAccess.Companion.configDirectory import de.staropensource.engine.base.utility.FileAccess.Companion.configDirectory
@ -570,7 +570,7 @@ class FileAccess {
// -----> Streams getters // -----> Streams getters
/** /**
* Returns a [FileStream] for reading * Returns a [Stream] for reading
* and writing from and to this file. * and writing from and to this file.
* *
* @return [FileAccessStream] instance * @return [FileAccessStream] instance