Skip to content

Commit 222788a

Browse files
committed
Upload first version of library
1 parent aff2413 commit 222788a

128 files changed

Lines changed: 13198 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

license_header.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
Copyright (c) 2006-${currentYear}, Emil Forslund. All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License"); You may not
5+
use this file except in compliance with the License. You may obtain a copy of
6+
the License at:
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
License for the specific language governing permissions and limitations under
14+
the License.
15+
16+

nbactions.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<actions>
3+
<action>
4+
<actionName>CUSTOM-Deploy Snapshot</actionName>
5+
<displayName>Deploy Snapshot</displayName>
6+
<goals>
7+
<goal>clean</goal>
8+
<goal>deploy</goal>
9+
</goals>
10+
</action>
11+
<action>
12+
<actionName>CUSTOM-Deploy Release</actionName>
13+
<displayName>Deploy Release</displayName>
14+
<goals>
15+
<goal>clean</goal>
16+
<goal>deploy</goal>
17+
<goal>-P</goal>
18+
<goal>release</goal>
19+
</goals>
20+
</action>
21+
</actions>

pom.xml

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
5+
Copyright (c) 2006-2016, Emil Forslund. All Rights Reserved.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License"); You may not
8+
use this file except in compliance with the License. You may obtain a copy of
9+
the License at:
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
License for the specific language governing permissions and limitations under
17+
the License.
18+
19+
-->
20+
<project xmlns="http://maven.apache.org/POM/4.0.0"
21+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
23+
24+
<modelVersion>4.0.0</modelVersion>
25+
<groupId>com.github.pyknic</groupId>
26+
<artifactId>immutable-array</artifactId>
27+
<version>1.0.0</version>
28+
<packaging>jar</packaging>
29+
30+
<name>Immutable Array</name>
31+
<description>
32+
Read-only primitive arrays backed by direct buffers that can hold a very
33+
large amount of elements.
34+
</description>
35+
<url>https://www.github.com/Pyknic/immutable-array/</url>
36+
37+
<properties>
38+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
39+
<maven.compiler.source>1.8</maven.compiler.source>
40+
<maven.compiler.target>1.8</maven.compiler.target>
41+
</properties>
42+
43+
<licenses>
44+
<license>
45+
<name>Apache License, Version 2.0</name>
46+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
47+
<distribution>repo</distribution>
48+
</license>
49+
</licenses>
50+
51+
<developers>
52+
<developer>
53+
<name>Emil Forslund</name>
54+
<email>emil@speedment.com</email>
55+
<organization>Speedment</organization>
56+
<organizationUrl>http://www.speedment.org</organizationUrl>
57+
</developer>
58+
</developers>
59+
60+
<scm>
61+
<connection>scm:git:git@github.com:pyknic/immutable-array.git</connection>
62+
<developerConnection>scm:git:git@github.com:pyknic/immutable-array.git</developerConnection>
63+
<url>git@github.com:pyknic/immutable-array.git</url>
64+
</scm>
65+
66+
<distributionManagement>
67+
<snapshotRepository>
68+
<id>ossrh</id>
69+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
70+
</snapshotRepository>
71+
<repository>
72+
<id>ossrh</id>
73+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
74+
</repository>
75+
</distributionManagement>
76+
77+
<build>
78+
<plugins>
79+
<plugin>
80+
<groupId>org.apache.maven.plugins</groupId>
81+
<artifactId>maven-compiler-plugin</artifactId>
82+
<version>3.3</version>
83+
<configuration>
84+
<compilerArgument>-Xlint:all</compilerArgument>
85+
<showWarnings>true</showWarnings>
86+
<showDeprecation>true</showDeprecation>
87+
</configuration>
88+
</plugin>
89+
</plugins>
90+
</build>
91+
92+
<profiles>
93+
<profile>
94+
<id>ossrh</id>
95+
<build>
96+
<plugins>
97+
<plugin>
98+
<groupId>com.mycila</groupId>
99+
<artifactId>license-maven-plugin</artifactId>
100+
<version>2.11</version>
101+
<configuration>
102+
<header>license_header.txt</header>
103+
<properties>
104+
<currentYear>2016</currentYear>
105+
</properties>
106+
<excludes>
107+
<exclude>**/README</exclude>
108+
<exclude>**/LICENSE</exclude>
109+
<exclude>**/nbactions.xml</exclude>
110+
<exclude>**/nb-configuration.xml</exclude>
111+
<exclude>src/test/resources/**</exclude>
112+
<exclude>src/main/resources/**</exclude>
113+
</excludes>
114+
</configuration>
115+
<executions>
116+
<execution>
117+
<goals>
118+
<goal>check</goal>
119+
</goals>
120+
</execution>
121+
</executions>
122+
</plugin>
123+
<plugin>
124+
<groupId>org.apache.maven.plugins</groupId>
125+
<artifactId>maven-source-plugin</artifactId>
126+
<version>3.0.0</version>
127+
<executions>
128+
<execution>
129+
<id>attach-sources</id>
130+
<goals>
131+
<goal>jar-no-fork</goal>
132+
</goals>
133+
</execution>
134+
</executions>
135+
</plugin>
136+
<plugin>
137+
<groupId>org.apache.maven.plugins</groupId>
138+
<artifactId>maven-javadoc-plugin</artifactId>
139+
<version>2.10.3</version>
140+
<executions>
141+
<execution>
142+
<id>attach-javadocs</id>
143+
<goals>
144+
<goal>jar</goal>
145+
</goals>
146+
</execution>
147+
</executions>
148+
<configuration>
149+
<docfilessubdirs>true</docfilessubdirs>
150+
<excludePackageNames>com.github.pyknic.immutablearray.internal.*</excludePackageNames>
151+
</configuration>
152+
</plugin>
153+
<plugin>
154+
<groupId>org.apache.maven.plugins</groupId>
155+
<artifactId>maven-gpg-plugin</artifactId>
156+
<version>1.6</version>
157+
<executions>
158+
<execution>
159+
<id>sign-artifacts</id>
160+
<phase>verify</phase>
161+
<goals>
162+
<goal>sign</goal>
163+
</goals>
164+
</execution>
165+
</executions>
166+
<configuration>
167+
<useagent>true</useagent>
168+
<keyname>${gpg.keyname}</keyname>
169+
<passphrase>${gpg.passphrase}</passphrase>
170+
<executable>${gpg.executable}</executable>
171+
</configuration>
172+
</plugin>
173+
<plugin>
174+
<groupId>org.sonatype.plugins</groupId>
175+
<artifactId>nexus-staging-maven-plugin</artifactId>
176+
<version>1.6.3</version>
177+
<extensions>true</extensions>
178+
<executions>
179+
<execution>
180+
<id>default-deploy</id>
181+
<phase>deploy</phase>
182+
<goals>
183+
<goal>deploy</goal>
184+
</goals>
185+
</execution>
186+
</executions>
187+
<configuration>
188+
<serverId>ossrh</serverId>
189+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
190+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
191+
</configuration>
192+
</plugin>
193+
</plugins>
194+
</build>
195+
</profile>
196+
</profiles>
197+
198+
<dependencies>
199+
<dependency>
200+
<groupId>junit</groupId>
201+
<artifactId>junit</artifactId>
202+
<version>4.12</version>
203+
<scope>test</scope>
204+
</dependency>
205+
</dependencies>
206+
</project>
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/**
2+
*
3+
* Copyright (c) 2006-2016, Emil Forslund. All Rights Reserved.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); You may not
6+
* use this file except in compliance with the License. You may obtain a copy of
7+
* the License at:
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14+
* License for the specific language governing permissions and limitations under
15+
* the License.
16+
*/
17+
package com.github.pyknic.bigarray;
18+
19+
import com.github.pyknic.bigarray.internal.ByteImmutableArrayBuilder;
20+
21+
/**
22+
* An immutable byte array that can hold a very large number of elements.
23+
* Implementations of this interface may or may not be backed by a direct buffer
24+
* depending on the size and how the data contained is structured.
25+
* <p>
26+
* To create a new instance of this interface, use the builder pattern initiated
27+
* with the {@link #builder()} method. The actual implementation that is used
28+
* will depend on the data that is passed to the builder. After the instance has
29+
* been built, it will be immutable.
30+
*
31+
* @author Emil Forslund
32+
* @since 1.0.0
33+
*/
34+
public interface ByteImmutableArray {
35+
36+
/**
37+
* Returns the value located at the specified index in the array. If the
38+
* index is outside the bounds of the array, the behavior is unspecified.
39+
*
40+
* @param index the index
41+
* @return the value at that index
42+
*/
43+
byte getAsByte(long index);
44+
45+
/**
46+
* Returns the length of the array (the number of bytes that can safely be
47+
* retrieved using the {@link #getAsByte(long)} method).
48+
*
49+
* @return the length
50+
*/
51+
long length();
52+
53+
/**
54+
* Creates a new builder. The builder guarantees that appended values will
55+
* be stored in the same order as they were inserted, but the actual size of
56+
* the array and how it is backed will be determined when the
57+
* {@link Builder#build()} method is finally invoked.
58+
* <p>
59+
* The builder should not be used after the {@link Builder#build()}-method
60+
* has been called.
61+
*
62+
* @return a new builder
63+
*/
64+
static Builder builder() {
65+
return new ByteImmutableArrayBuilder();
66+
}
67+
68+
/**
69+
* A builder for a {@link ByteImmutableArray}. The builder can be appended
70+
* with values using the {@link #append(byte)}-method until it is finalized
71+
* using the {@link #build()}-method. The backing implementation will be
72+
* decided once the array is built.
73+
* <p>
74+
* The implementation of {@code Builder} is intended to handle a very large
75+
* amount of bytes as well as a very small amount.
76+
*/
77+
interface Builder {
78+
79+
/**
80+
* Append an value to the builder.
81+
*
82+
* @param value the value to append
83+
* @return a reference to this builder
84+
*/
85+
ByteImmutableArray.Builder append(byte value);
86+
87+
/**
88+
* Builds the array. After this method has been called, the builder
89+
* should be discarded. The returned array is immutable.
90+
*
91+
* @return the built array
92+
*/
93+
ByteImmutableArray build();
94+
95+
}
96+
}

0 commit comments

Comments
 (0)