Skip to content

Commit

Permalink
external package renamed to tools
Browse files Browse the repository at this point in the history
  • Loading branch information
pull-vert committed Feb 2, 2025
1 parent 3ea0e93 commit 476ce6c
Show file tree
Hide file tree
Showing 31 changed files with 48 additions and 48 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/jayo/internal/BaseByteString.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
import java.util.Arrays;
import java.util.Objects;

import static jayo.external.JayoUtils.checkOffsetAndCount;
import static jayo.internal.UnsafeUtils.*;
import static jayo.internal.Utils.HEX_DIGIT_CHARS;
import static jayo.internal.Utils.arrayRangeEquals;
import static jayo.tools.JayoUtils.checkOffsetAndCount;

public sealed class BaseByteString implements ByteString permits RealUtf8, SegmentedByteString {
@Serial
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jayo/internal/DeflaterRawWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
import java.util.Objects;
import java.util.zip.Deflater;

import static jayo.external.JayoUtils.checkOffsetAndCount;
import static jayo.internal.WriterSegmentQueue.newWriterSegmentQueue;
import static jayo.tools.JayoUtils.checkOffsetAndCount;

public final class DeflaterRawWriter implements RawWriter {
private final @NonNull WriterSegmentQueue segmentQueue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import jayo.JayoClosedResourceException;
import jayo.JayoException;
import jayo.RawWriter;
import jayo.external.CancelToken;
import jayo.tools.CancelToken;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;

Expand All @@ -20,8 +20,8 @@
import java.util.Objects;

import static java.lang.System.Logger.Level.TRACE;
import static jayo.external.JayoUtils.checkOffsetAndCount;
import static jayo.internal.RealAsyncTimeout.TIMEOUT_WRITE_SIZE;
import static jayo.tools.JayoUtils.checkOffsetAndCount;

public final class GatheringByteChannelRawWriter implements RawWriter {
private static final System.Logger LOGGER = System.getLogger("jayo.ScatteringByteChannelRawWriter");
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jayo/internal/InputStreamRawReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import jayo.Buffer;
import jayo.JayoException;
import jayo.RawReader;
import jayo.external.CancelToken;
import jayo.tools.CancelToken;
import org.jspecify.annotations.NonNull;

import java.io.IOException;
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/jayo/internal/OutputStreamRawWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import jayo.Buffer;
import jayo.JayoException;
import jayo.RawWriter;
import jayo.external.CancelToken;
import jayo.tools.CancelToken;
import org.jspecify.annotations.NonNull;

import java.io.FileOutputStream;
Expand All @@ -33,7 +33,7 @@
import java.util.Objects;

import static java.lang.System.Logger.Level.TRACE;
import static jayo.external.JayoUtils.checkOffsetAndCount;
import static jayo.tools.JayoUtils.checkOffsetAndCount;

public final class OutputStreamRawWriter implements RawWriter {
private static final System.Logger LOGGER = System.getLogger("jayo.OutputStreamRawWriter");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import jayo.Buffer;
import jayo.JayoException;
import jayo.RawReader;
import jayo.external.CancelToken;
import jayo.tools.CancelToken;
import org.jspecify.annotations.NonNull;

import java.io.IOException;
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/jayo/internal/RealAsyncTimeout.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
package jayo.internal;

import jayo.*;
import jayo.external.AsyncTimeout;
import jayo.tools.AsyncTimeout;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;

Expand All @@ -34,7 +34,7 @@
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.Supplier;

import static jayo.external.JayoUtils.checkOffsetAndCount;
import static jayo.tools.JayoUtils.checkOffsetAndCount;

/**
* This timeout uses a background watchdog thread to take action exactly when the timeout occurs. Use this to implement
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jayo/internal/RealBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@
import java.util.function.BiFunction;

import static java.lang.System.Logger.Level.TRACE;
import static jayo.external.JayoUtils.checkOffsetAndCount;
import static jayo.internal.Segment.TRANSFERRING;
import static jayo.internal.Segment.WRITING;
import static jayo.internal.UnsafeUtils.*;
import static jayo.internal.Utf8Utils.UTF8_REPLACEMENT_CODE_POINT;
import static jayo.internal.Utils.*;
import static jayo.tools.JayoUtils.checkOffsetAndCount;


public final class RealBuffer implements Buffer {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jayo/internal/RealByteString.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
import java.util.Arrays;
import java.util.Objects;

import static jayo.external.JayoUtils.checkOffsetAndCount;
import static jayo.internal.BaseByteString.*;
import static jayo.internal.UnsafeUtils.noCopyStringFromLatin1Bytes;
import static jayo.internal.Utils.HEX_DIGIT_CHARS;
import static jayo.tools.JayoUtils.checkOffsetAndCount;

public final /*Valhalla 'primitive class' or at least 'value class'*/ class RealByteString implements ByteString {
@Serial
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jayo/internal/RealCancelToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import jayo.CancelScope;
import jayo.JayoInterruptedIOException;
import jayo.JayoTimeoutException;
import jayo.external.CancelToken;
import jayo.tools.CancelToken;
import org.jspecify.annotations.NonNull;

import java.util.Objects;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
package jayo.internal;

import jayo.*;
import jayo.external.CancelToken;
import jayo.tools.CancelToken;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jayo/internal/RealReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
import java.nio.charset.Charset;
import java.util.Objects;

import static jayo.external.JayoUtils.checkOffsetAndCount;
import static jayo.internal.ReaderSegmentQueue.newReaderSegmentQueue;
import static jayo.internal.ReaderSegmentQueue.newSyncReaderSegmentQueue;
import static jayo.tools.JayoUtils.checkOffsetAndCount;

public final class RealReader implements Reader {
private static final long INTEGER_MAX_PLUS_1 = (long) Integer.MAX_VALUE + 1;
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jayo/internal/RealTlsEndpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

import static java.lang.System.Logger.Level.DEBUG;
import static java.lang.System.Logger.Level.TRACE;
import static jayo.external.JayoUtils.checkOffsetAndCount;
import static jayo.internal.WriterSegmentQueue.newWriterSegmentQueue;
import static jayo.tools.JayoUtils.checkOffsetAndCount;

public final class RealTlsEndpoint {
private static final System.Logger LOGGER = System.getLogger("jayo.tls.TlsEndpoint");
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jayo/internal/SegmentedByteString.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
import java.util.Arrays;
import java.util.Objects;

import static jayo.external.JayoUtils.checkOffsetAndCount;
import static jayo.internal.Utils.arrayRangeEquals;
import static jayo.tools.JayoUtils.checkOffsetAndCount;

/**
* An immutable byte string composed of segments. This class exists to implement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package jayo.internal;

import jayo.external.BasicFifoQueue;
import jayo.tools.BasicFifoQueue;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import jayo.Buffer;
import jayo.JayoException;
import jayo.RawWriter;
import jayo.external.CancelToken;
import jayo.tools.CancelToken;
import org.jspecify.annotations.NonNull;

import java.io.IOException;
Expand All @@ -17,7 +17,7 @@
import java.util.Objects;

import static java.lang.System.Logger.Level.TRACE;
import static jayo.external.JayoUtils.checkOffsetAndCount;
import static jayo.tools.JayoUtils.checkOffsetAndCount;

public final class WritableByteChannelRawWriter implements RawWriter {
private static final System.Logger LOGGER = System.getLogger("jayo.WritableByteChannelRawWriter");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
package jayo.internal.scheduling;

import jayo.Jayo;
import jayo.external.BasicFifoQueue;
import jayo.scheduling.ScheduledTaskQueue;
import jayo.scheduling.TaskQueue;
import jayo.tools.BasicFifoQueue;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;

Expand All @@ -35,8 +35,8 @@
import java.util.concurrent.RejectedExecutionException;
import java.util.function.LongSupplier;

import static jayo.external.JayoUtils.removePrefix;
import static jayo.internal.scheduling.TaskLogger.formatDuration;
import static jayo.tools.JayoUtils.removePrefix;

public sealed abstract class RealTaskQueue<T extends Task<T>> implements TaskQueue {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

package jayo.internal.scheduling;

import jayo.external.BasicFifoQueue;
import jayo.scheduling.TaskRunner;
import jayo.tools.BasicFifoQueue;
import org.jspecify.annotations.NonNull;

import java.util.PriorityQueue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

package jayo.internal.tls;

import jayo.external.JayoUtils;
import jayo.tools.JayoUtils;
import org.jspecify.annotations.NonNull;

import javax.net.ssl.SSLEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* limitations under the License.
*/

package jayo.external;
package jayo.tools;

import jayo.CancelScope;
import jayo.JayoInterruptedIOException;
Expand Down Expand Up @@ -74,15 +74,15 @@ public sealed interface AsyncTimeout permits RealAsyncTimeout {
<T> T withTimeout(final @NonNull CancelScope cancelScope, final @NonNull Supplier<T> block);

/**
* @param writer the delegate writer.
* @param writer the delegate writer.
* @return a new writer that delegates to {@code writer}, using this to implement timeouts. If a timeout occurs, the
* {@code onTimeout} code block declared in {@link #create(Runnable)} will execute.
*/
@NonNull
RawWriter writer(final @NonNull RawWriter writer);

/**
* @param reader the delegate reader.
* @param reader the delegate reader.
* @return a new reader that delegates to {@code reader}, using this to implement timeouts. If a timeout occurs, the
* {@code onTimeout} code block declared in {@link #create(Runnable)} will execute.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Use of this source code is governed by the Apache 2.0 license.
*/

package jayo.external;
package jayo.tools;

import jayo.internal.SinglyLinkedBasicFifoQueue;
import org.jspecify.annotations.NonNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Use of this source code is governed by the Apache 2.0 license.
*/

package jayo.external;
package jayo.tools;

import jayo.JayoInterruptedIOException;
import jayo.internal.CancellableUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* limitations under the License.
*/

package jayo.external;
package jayo.tools;

import org.jspecify.annotations.NonNull;

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

exports jayo;
exports jayo.crypto;
exports jayo.external;
exports jayo.network;
exports jayo.scheduling;
exports jayo.tls;
exports jayo.tools;
}
14 changes: 7 additions & 7 deletions core/src/test/java/jayo/internal/AsyncTimeoutTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
package jayo.internal;

import jayo.Cancellable;
import jayo.external.AsyncTimeout;
import jayo.tools.AsyncTimeout;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -134,12 +134,12 @@ public void instancesAddedAtEnd() {
Cancellable.run(Duration.ofMillis(75), cancelScope2 ->
Cancellable.run(Duration.ofMillis(50), cancelScope3 ->
Cancellable.run(Duration.ofMillis(25), cancelScope4 -> {
try {
Thread.sleep(125);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
})));
try {
Thread.sleep(125);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
})));
});
assertTrue(a.exit());
assertTrue(b.exit());
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/kotlin/jayo/internal/AwaitMonitorTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

package jayo.internal

import jayo.cancelScope
import jayo.JayoInterruptedIOException
import jayo.JayoTimeoutException
import jayo.external.CancelToken
import jayo.cancelScope
import jayo.internal.TestUtil.assumeNotWindows
import jayo.tools.CancelToken
import org.assertj.core.api.Assertions.*
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/kotlin/jayo/internal/AwaitSignalTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

package jayo.internal

import jayo.cancelScope
import jayo.JayoInterruptedIOException
import jayo.JayoTimeoutException
import jayo.external.CancelToken
import jayo.cancelScope
import jayo.internal.TestUtil.assumeNotWindows
import jayo.tools.CancelToken
import org.assertj.core.api.Assertions.*
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test
Expand Down
6 changes: 3 additions & 3 deletions core/src/test/kotlin/jayo/internal/BasicFifoQueueTest.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package jayo.internal

import jayo.external.BasicFifoQueue
import org.junit.jupiter.api.Test
import jayo.tools.BasicFifoQueue
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test

class BasicFifoQueueTest {
@Test
Expand All @@ -12,7 +12,7 @@ class BasicFifoQueueTest {
assertThat(queue.offer(2)).isFalse
assertThat(queue.offer(3)).isFalse
}

@Test
fun testIterator() {
val queue = BasicFifoQueue.create<Int>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import jayo.JayoClosedResourceException;
import jayo.JayoException;
import jayo.RawReader;
import jayo.external.CancelToken;
import jayo.tools.CancelToken;
import org.jspecify.annotations.NonNull;

import java.io.IOException;
Expand Down
4 changes: 2 additions & 2 deletions samples/src/main/java/jayo/samples/ByteChannelRawWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@

import jayo.Buffer;
import jayo.JayoClosedResourceException;
import jayo.RawWriter;
import jayo.JayoException;
import jayo.external.CancelToken;
import jayo.RawWriter;
import jayo.tools.CancelToken;
import org.jspecify.annotations.NonNull;

import java.io.IOException;
Expand Down

0 comments on commit 476ce6c

Please sign in to comment.