Removed unnecessary decoration
This commit is contained in:
parent
a848c51620
commit
b694d6a084
|
@ -127,7 +127,7 @@ public class Content
|
|||
* @param source the source to read
|
||||
* @param promise the promise to notify when the whole content has been read into a ByteBuffer.
|
||||
*/
|
||||
public static void asByteBuffer(Source source, Promise<ByteBuffer> promise)
|
||||
static void asByteBuffer(Source source, Promise<ByteBuffer> promise)
|
||||
{
|
||||
new ContentSourceByteBuffer(source, promise).run();
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ public class Content
|
|||
* @return the ByteBuffer containing the content
|
||||
* @throws IOException if reading the content fails
|
||||
*/
|
||||
public static ByteBuffer asByteBuffer(Source source) throws IOException
|
||||
static ByteBuffer asByteBuffer(Source source) throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -161,7 +161,7 @@ public class Content
|
|||
* @param charset the charset to use to convert the bytes into characters
|
||||
* @param promise the promise to notify when the whole content has been converted into a String
|
||||
*/
|
||||
public static void asString(Source source, Charset charset, Promise<String> promise)
|
||||
static void asString(Source source, Charset charset, Promise<String> promise)
|
||||
{
|
||||
new ContentSourceString(source, charset, promise).convert();
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ public class Content
|
|||
* @return the String obtained from the content
|
||||
* @throws IOException if reading the content fails
|
||||
*/
|
||||
public static String asString(Source source) throws IOException
|
||||
static String asString(Source source) throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -194,7 +194,7 @@ public class Content
|
|||
* @param source the source to read from
|
||||
* @return an InputStream that reads from the content source
|
||||
*/
|
||||
public static InputStream asInputStream(Source source)
|
||||
static InputStream asInputStream(Source source)
|
||||
{
|
||||
return new ContentSourceInputStream(source);
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ public class Content
|
|||
* @param source the source to read from
|
||||
* @return a Publisher that publishes chunks read from the content source
|
||||
*/
|
||||
public static Flow.Publisher<Chunk> asPublisher(Source source)
|
||||
static Flow.Publisher<Chunk> asPublisher(Source source)
|
||||
{
|
||||
return new ContentSourcePublisher(source);
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ public class Content
|
|||
* @param callback the callback to notify when the whole content has been read
|
||||
* or an error occurred while reading the content
|
||||
*/
|
||||
public static void consumeAll(Source source, Callback callback)
|
||||
static void consumeAll(Source source, Callback callback)
|
||||
{
|
||||
new ContentSourceConsumer(source, callback).run();
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ public class Content
|
|||
* @param source the source to read from
|
||||
* @throws IOException if reading the content fails
|
||||
*/
|
||||
public static void consumeAll(Source source) throws IOException
|
||||
static void consumeAll(Source source) throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -247,7 +247,7 @@ public class Content
|
|||
/**
|
||||
* @return the content length, if known, or -1 if the content length is unknown
|
||||
*/
|
||||
public default long getLength()
|
||||
default long getLength()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ public class Content
|
|||
* @return a chunk of content, possibly an error instance, or {@code null}
|
||||
* @see #demand(Runnable)
|
||||
*/
|
||||
public Chunk read();
|
||||
Chunk read();
|
||||
|
||||
/**
|
||||
* <p>Demands to invoke the given demand callback parameter when a chunk of content is available.</p>
|
||||
|
@ -301,7 +301,7 @@ public class Content
|
|||
* @throws IllegalStateException when this method is called with an existing demand
|
||||
* @see #read()
|
||||
*/
|
||||
public void demand(Runnable demandCallback);
|
||||
void demand(Runnable demandCallback);
|
||||
|
||||
/**
|
||||
* <p>Fails this content source, possibly failing and discarding accumulated
|
||||
|
@ -313,7 +313,7 @@ public class Content
|
|||
*
|
||||
* @param failure the cause of the failure
|
||||
*/
|
||||
public void fail(Throwable failure);
|
||||
void fail(Throwable failure);
|
||||
|
||||
/**
|
||||
* <p>A wrapper of a nested source of content, that may transform the chunks obtained from
|
||||
|
@ -323,7 +323,7 @@ public class Content
|
|||
* <p>Implementations should override {@link #transform(Chunk)} with the transformation
|
||||
* logic.</p>
|
||||
*/
|
||||
public abstract static class Transformer extends ContentSourceTransformer
|
||||
abstract class Transformer extends ContentSourceTransformer
|
||||
{
|
||||
public Transformer(Content.Source rawSource)
|
||||
{
|
||||
|
@ -362,7 +362,7 @@ public class Content
|
|||
* @param sink the sink to write to
|
||||
* @return an OutputStream that writes to the content sink
|
||||
*/
|
||||
public static OutputStream asOutputStream(Sink sink)
|
||||
static OutputStream asOutputStream(Sink sink)
|
||||
{
|
||||
return new ContentSinkOutputStream(sink);
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ public class Content
|
|||
* @param callback the callback to notify when the Subscriber is complete
|
||||
* @return a Subscriber that writes to the content sink
|
||||
*/
|
||||
public static Flow.Subscriber<Chunk> asSubscriber(Sink sink, Callback callback)
|
||||
static Flow.Subscriber<Chunk> asSubscriber(Sink sink, Callback callback)
|
||||
{
|
||||
return new ContentSinkSubscriber(sink, callback);
|
||||
}
|
||||
|
@ -387,7 +387,7 @@ public class Content
|
|||
* @param byteBuffer the ByteBuffers to write
|
||||
* @throws IOException if the write operation fails
|
||||
*/
|
||||
public static void write(Sink sink, boolean last, ByteBuffer byteBuffer) throws IOException
|
||||
static void write(Sink sink, boolean last, ByteBuffer byteBuffer) throws IOException
|
||||
{
|
||||
try (Blocking.Callback callback = Blocking.callback())
|
||||
{
|
||||
|
@ -404,7 +404,7 @@ public class Content
|
|||
* @param utf8Content the String to write
|
||||
* @param callback the callback to notify when the write operation is complete
|
||||
*/
|
||||
public static void write(Sink sink, boolean last, String utf8Content, Callback callback)
|
||||
static void write(Sink sink, boolean last, String utf8Content, Callback callback)
|
||||
{
|
||||
sink.write(last, StandardCharsets.UTF_8.encode(utf8Content), callback);
|
||||
}
|
||||
|
@ -417,7 +417,7 @@ public class Content
|
|||
* @param byteBuffer the ByteBuffer to write
|
||||
* @param callback the callback to notify when the write operation is complete
|
||||
*/
|
||||
public void write(boolean last, ByteBuffer byteBuffer, Callback callback);
|
||||
void write(boolean last, ByteBuffer byteBuffer, Callback callback);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -431,11 +431,11 @@ public class Content
|
|||
/**
|
||||
* <p>An empty, non-last, chunk.</p>
|
||||
*/
|
||||
public static final Chunk EMPTY = ByteBufferChunk.EMPTY;
|
||||
Chunk EMPTY = ByteBufferChunk.EMPTY;
|
||||
/**
|
||||
* <p>An empty, last, chunk.</p>
|
||||
*/
|
||||
public static final Content.Chunk EOF = ByteBufferChunk.EOF;
|
||||
Content.Chunk EOF = ByteBufferChunk.EOF;
|
||||
|
||||
/**
|
||||
* <p>Creates a last/non-last Chunk with the given ByteBuffer.</p>
|
||||
|
@ -444,7 +444,7 @@ public class Content
|
|||
* @param last whether the Chunk is the last one
|
||||
* @return a new Chunk
|
||||
*/
|
||||
public static Chunk from(ByteBuffer byteBuffer, boolean last)
|
||||
static Chunk from(ByteBuffer byteBuffer, boolean last)
|
||||
{
|
||||
return from(byteBuffer, last, null);
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ public class Content
|
|||
* @param releaser the code to run when this Chunk is released
|
||||
* @return a new Chunk
|
||||
*/
|
||||
public static Chunk from(ByteBuffer byteBuffer, boolean last, Runnable releaser)
|
||||
static Chunk from(ByteBuffer byteBuffer, boolean last, Runnable releaser)
|
||||
{
|
||||
return new ByteBufferChunk(byteBuffer, last, releaser);
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ public class Content
|
|||
* @param failure the cause of the failure
|
||||
* @return a new Error.Chunk
|
||||
*/
|
||||
public static Error from(Throwable failure)
|
||||
static Error from(Throwable failure)
|
||||
{
|
||||
return new Error(failure);
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ public class Content
|
|||
* </tbody>
|
||||
* </table>
|
||||
*/
|
||||
public static Chunk next(Chunk chunk)
|
||||
static Chunk next(Chunk chunk)
|
||||
{
|
||||
if (chunk == null || chunk instanceof Error)
|
||||
return chunk;
|
||||
|
@ -514,22 +514,22 @@ public class Content
|
|||
/**
|
||||
* @return the ByteBuffer of this Chunk
|
||||
*/
|
||||
public ByteBuffer getByteBuffer();
|
||||
ByteBuffer getByteBuffer();
|
||||
|
||||
/**
|
||||
* @return whether this is the last Chunk
|
||||
*/
|
||||
public boolean isLast();
|
||||
boolean isLast();
|
||||
|
||||
/**
|
||||
* <p>Releases the resources associated to this Chunk.</p>
|
||||
*/
|
||||
public void release();
|
||||
void release();
|
||||
|
||||
/**
|
||||
* @return the number of bytes remaining in this Chunk
|
||||
*/
|
||||
public default int remaining()
|
||||
default int remaining()
|
||||
{
|
||||
return getByteBuffer().remaining();
|
||||
}
|
||||
|
@ -537,7 +537,7 @@ public class Content
|
|||
/**
|
||||
* @return whether this Chunk has remaining bytes
|
||||
*/
|
||||
public default boolean hasRemaining()
|
||||
default boolean hasRemaining()
|
||||
{
|
||||
return getByteBuffer().hasRemaining();
|
||||
}
|
||||
|
@ -550,7 +550,7 @@ public class Content
|
|||
* @param length the maximum number of bytes to copy
|
||||
* @return the number of bytes actually copied
|
||||
*/
|
||||
public default int get(byte[] bytes, int offset, int length)
|
||||
default int get(byte[] bytes, int offset, int length)
|
||||
{
|
||||
ByteBuffer b = getByteBuffer();
|
||||
if (b == null || !b.hasRemaining())
|
||||
|
@ -566,7 +566,7 @@ public class Content
|
|||
* @param length the maximum number of bytes to skip
|
||||
* @return the number of bytes actually skipped
|
||||
*/
|
||||
public default int skip(int length)
|
||||
default int skip(int length)
|
||||
{
|
||||
ByteBuffer byteBuffer = getByteBuffer();
|
||||
length = Math.min(byteBuffer.remaining(), length);
|
||||
|
@ -582,7 +582,7 @@ public class Content
|
|||
*
|
||||
* @return whether this Chunk is a terminal chunk
|
||||
*/
|
||||
public default boolean isTerminal()
|
||||
default boolean isTerminal()
|
||||
{
|
||||
return this instanceof Error || isLast() && !hasRemaining();
|
||||
}
|
||||
|
@ -593,7 +593,7 @@ public class Content
|
|||
*
|
||||
* @see #from(Throwable)
|
||||
*/
|
||||
public static final class Error implements Chunk
|
||||
final class Error implements Chunk
|
||||
{
|
||||
private final Throwable cause;
|
||||
|
||||
|
|
Loading…
Reference in New Issue