1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-24 00:50:32 +00:00

Add comments to SharpStreams

This commit is contained in:
Stypox 2021-01-16 14:35:15 +01:00
parent bcb1cf6603
commit eea43d5a73
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
3 changed files with 16 additions and 1 deletions

View File

@ -5,6 +5,10 @@ import androidx.annotation.NonNull;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
/**
* Simply wraps a readable {@link SharpStream} allowing it to be used with built-in Java stuff that
* supports {@link InputStream}.
*/
public class SharpInputStream extends InputStream { public class SharpInputStream extends InputStream {
private final SharpStream stream; private final SharpStream stream;

View File

@ -5,6 +5,10 @@ import androidx.annotation.NonNull;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
/**
* Simply wraps a writable {@link SharpStream} allowing it to be used with built-in Java stuff that
* supports {@link OutputStream}.
*/
public class SharpOutputStream extends OutputStream { public class SharpOutputStream extends OutputStream {
private final SharpStream stream; private final SharpStream stream;

View File

@ -5,7 +5,14 @@ import java.io.Flushable;
import java.io.IOException; import java.io.IOException;
/** /**
* Based on C#'s Stream class. * Based on C#'s Stream class. SharpStream is a wrapper around the 2 different APIs for SAF
* ({@link us.shandian.giga.io.FileStreamSAF}) and non-SAF ({@link us.shandian.giga.io.FileStream}).
* It has both input and output like in C#, while in Java those are usually different classes.
* {@link SharpInputStream} and {@link SharpOutputStream} are simple classes that wrap
* {@link SharpStream} and extend respectively {@link java.io.InputStream} and
* {@link java.io.OutputStream}, since unfortunately a class can only extend one class, so that a
* sharp stream can be used with built-in Java stuff that supports {@link java.io.InputStream}
* or {@link java.io.OutputStream}.
*/ */
public abstract class SharpStream implements Closeable, Flushable { public abstract class SharpStream implements Closeable, Flushable {
public abstract int read() throws IOException; public abstract int read() throws IOException;