This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WhiteByteChannel implements ReadableByteChannel { | |
@Override | |
public int read(final ByteBuffer dst) throws IOException { | |
final int remaining = dst.remaining(); | |
dst.position(dst.limit()); | |
return remaining; | |
} | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BlackByteChannel implements WritableByteChannel { | |
@Override | |
public int write(final ByteBuffer src) throws IOException { | |
final int remainging = src.remaining(); | |
src.position(src.limit()); | |
return remainging; | |
} | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FunnelInputStream extends FilterInputStream { | |
public FunnelInputStream(final InputStream in) { | |
super(in); | |
} | |
@Override | |
public int read(final byte[] b, final int off, final int len) throws IOExeption { | |
if (b == null) { | |
throw new NullPointerException("null b"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FunnelOutputStream extends FilterOutputStream { | |
public FunnelOutputStream(final OutputStream out) { | |
super(out); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CodeSnippetsInJavadoc { | |
/** | |
* Prints {@code hello, world\n} to {@code stdout}. | |
* | |
* <blockquote><pre>{@code | |
* public static void main(final String[] args) { | |
* System.out.printf("hello, world\n"); | |
* } | |
* }</pre></blockquote> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$file = "setup-x86_64.exe" | |
Invoke-WebRequest -OutFile $file https://www.cygwin.com/$file | |
Invoke-Expression .\$file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>test</groupId> | |
<artifactId>enforcer-dependency-convergence-test</artifactId> | |
<version>0.1-SNAPSHOT</version> | |
<packaging>jar</packaging> | |
<dependencies> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.nio.ByteBuffer; | |
import java.util.Arrays; | |
import static java.util.concurrent.ThreadLocalRandom.current; | |
public class ArrayWrappingByteBufferTest { | |
public static void main(final String[] args) { | |
final byte[] array = new byte[] {1, 1, 1, 1, 1, 1, 1, 1}; | |
System.out.println("array: " + Arrays.toString(array)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/beans_1_1.xsd"> | |
</beans> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.ByteArrayInputStream; | |
import java.io.ByteArrayOutputStream; | |
import java.nio.charset.StandardCharsets; | |
import java.security.SecureRandom; | |
import java.util.Random; | |
import java.util.function.IntConsumer; | |
import java.util.function.IntSupplier; | |
/** | |
* Encodes/Decodes (maximum) 36-bit unsigned values. |