All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.softicar.platform.common.io.reader.IManagedReader Maven / Gradle / Ivy

Go to download

The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.

There is a newer version: 50.0.0
Show newest version
package com.softicar.platform.common.io.reader;

import com.softicar.platform.common.io.writer.ManagedWriter;
import java.io.Closeable;
import java.io.Reader;
import java.util.Collection;

/**
 * An {@link IManagedReader} is similar to a {@link Reader} but does not
 * implement {@link Closeable} or {@link AutoCloseable}.
 * 

* The life-cycle of the underlying {@link Reader} is managed outside the scope * of the {@link ManagedReader}. * * @author Oliver Richers */ public interface IManagedReader { /** * Reads characters from this {@link IManagedReader} into the given buffer. * * @param buffer * the buffer array (never null) * @return the number of characters read; -1 indicates the end of this * {@link IManagedReader} */ int read(char[] buffer); /** * Reads all lines from this {@link IManagedReader}. * * @return all lines of text (never null) */ Collection readLines(); /** * Reads all remaining text from this {@link IManagedReader}. * * @return all remaining text (never null) */ default String readAll() { StringBuilder builder = new StringBuilder(); new ManagedWriter(builder).write(this); return builder.toString(); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy