Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

Commit d279fef

Browse files
committed
eat: add SsFormat encoding library
1 parent 7d98f4e commit d279fef

9 files changed

Lines changed: 1480 additions & 27 deletions

File tree

.github/release-please.yml

Lines changed: 57 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,60 @@ releaseType: java-yoshi
22
bumpMinorPreMajor: true
33
handleGHRelease: true
44
branches:
5-
- branch: 3.3.x
6-
- branch: 4.0.x
7-
- branch: 5.2.x
8-
- branch: 6.4.4-sp
9-
releaseType: java-lts
10-
- branch: 6.14.x
11-
releaseType: java-backport
12-
- branch: 6.23.x
13-
- branch: 6.33.x
14-
- branch: 6.55.x
15-
releaseType: java-backport
16-
- branch: 6.67.x
17-
releaseType: java-backport
18-
- branch: 6.66.x
19-
releaseType: java-backport
20-
- branch: 6.88.x
21-
releaseType: java-backport
22-
- branch: 6.96.x
23-
releaseType: java-backport
24-
- branch: 6.95.x
25-
releaseType: java-backport
26-
- branch: protobuf-4.x-rc
27-
manifest: true
5+
- branch: 3.3.x
6+
releaseType: java-yoshi
7+
bumpMinorPreMajor: true
8+
handleGHRelease: true
9+
- branch: 4.0.x
10+
releaseType: java-yoshi
11+
bumpMinorPreMajor: true
12+
handleGHRelease: true
13+
- branch: 5.2.x
14+
releaseType: java-yoshi
15+
bumpMinorPreMajor: true
16+
handleGHRelease: true
17+
- releaseType: java-lts
18+
bumpMinorPreMajor: true
19+
handleGHRelease: true
20+
branch: 6.4.4-sp
21+
- releaseType: java-backport
22+
bumpMinorPreMajor: true
23+
handleGHRelease: true
24+
branch: 6.14.x
25+
- releaseType: java-yoshi
26+
bumpMinorPreMajor: true
27+
handleGHRelease: true
28+
branch: 6.23.x
29+
- releaseType: java-yoshi
30+
bumpMinorPreMajor: true
31+
handleGHRelease: true
32+
branch: 6.33.x
33+
- releaseType: java-backport
34+
bumpMinorPreMajor: true
35+
handleGHRelease: true
36+
branch: 6.55.x
37+
- releaseType: java-backport
38+
bumpMinorPreMajor: true
39+
handleGHRelease: true
40+
branch: 6.67.x
41+
- releaseType: java-backport
42+
bumpMinorPreMajor: true
43+
handleGHRelease: true
44+
branch: 6.66.x
45+
- releaseType: java-backport
46+
bumpMinorPreMajor: true
47+
handleGHRelease: true
48+
branch: 6.88.x
49+
- releaseType: java-backport
50+
bumpMinorPreMajor: true
51+
handleGHRelease: true
52+
branch: 6.96.x
53+
- releaseType: java-backport
54+
bumpMinorPreMajor: true
55+
handleGHRelease: true
56+
branch: 6.95.x
57+
- releaseType: java-yoshi
58+
bumpMinorPreMajor: true
59+
handleGHRelease: true
60+
branch: protobuf-4.x-rc
61+
manifest: true

.github/workflows/hermetic_library_generation.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
with:
3838
fetch-depth: 0
3939
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
40-
- uses: googleapis/sdk-platform-java/.github/scripts@v2.65.1
40+
- uses: googleapis/sdk-platform-java/.github/scripts@v2.64.2
4141
if: env.SHOULD_RUN == 'true'
4242
with:
4343
base_ref: ${{ github.base_ref }}

.github/workflows/unmanaged_dependency_check.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ jobs:
1717
# repository
1818
.kokoro/build.sh
1919
- name: Unmanaged dependency check
20-
uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.55.1
20+
uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.54.2
2121
with:
2222
bom-path: google-cloud-spanner-bom/pom.xml

google-cloud-spanner-bom/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>com.google.cloud</groupId>
1010
<artifactId>sdk-platform-java-config</artifactId>
11-
<version>3.55.1</version>
11+
<version>3.54.2</version>
1212
</parent>
1313

1414
<name>Google Cloud Spanner BOM</name>
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/*
2+
* Copyright 2026 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of 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,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.spanner.spi.v1;
18+
19+
import com.google.api.core.InternalApi;
20+
import java.util.Arrays;
21+
22+
/**
23+
* A simple, unsynchronized byte array output stream optimized for ssformat key encoding.
24+
*
25+
* <p>Unlike {@link java.io.ByteArrayOutputStream}, this class is not thread-safe and does not incur
26+
* synchronization overhead. This provides better performance for single-threaded key encoding
27+
* operations in the SpanFE bypass hot path.
28+
*
29+
* <p>This class is not intended for general use and should only be used within the ssformat
30+
* encoding implementation.
31+
*/
32+
@InternalApi
33+
public final class GrowableByteArrayOutputStream {
34+
35+
private byte[] buf;
36+
private int count;
37+
38+
/** Creates a new output stream with a default initial capacity of 32 bytes. */
39+
public GrowableByteArrayOutputStream() {
40+
this(32);
41+
}
42+
43+
/**
44+
* Creates a new output stream with the specified initial capacity.
45+
*
46+
* @param initialCapacity the initial buffer size
47+
* @throws IllegalArgumentException if initialCapacity is negative
48+
*/
49+
public GrowableByteArrayOutputStream(int initialCapacity) {
50+
if (initialCapacity < 0) {
51+
throw new IllegalArgumentException("Negative initial capacity: " + initialCapacity);
52+
}
53+
this.buf = new byte[initialCapacity];
54+
}
55+
56+
private void ensureCapacity(int minCapacity) {
57+
if (minCapacity > buf.length) {
58+
int newCapacity = Math.max(buf.length << 1, minCapacity);
59+
buf = Arrays.copyOf(buf, newCapacity);
60+
}
61+
}
62+
63+
/**
64+
* Writes the specified byte to this output stream.
65+
*
66+
* @param b the byte to write (only the low 8 bits are used)
67+
*/
68+
public void write(int b) {
69+
ensureCapacity(count + 1);
70+
buf[count++] = (byte) b;
71+
}
72+
73+
/**
74+
* Writes a portion of a byte array to this output stream.
75+
*
76+
* @param b the source byte array
77+
* @param off the start offset in the array
78+
* @param len the number of bytes to write
79+
*/
80+
public void write(byte[] b, int off, int len) {
81+
ensureCapacity(count + len);
82+
System.arraycopy(b, off, buf, count, len);
83+
count += len;
84+
}
85+
86+
/**
87+
* Returns a copy of the buffer contents as a new byte array.
88+
*
89+
* @return a new byte array containing the written bytes
90+
*/
91+
public byte[] toByteArray() {
92+
return Arrays.copyOf(buf, count);
93+
}
94+
95+
/** Resets the buffer so that it can be reused. The underlying buffer is retained. */
96+
public void reset() {
97+
count = 0;
98+
}
99+
100+
/**
101+
* Returns the current number of bytes written to this stream.
102+
*
103+
* @return the number of valid bytes in the buffer
104+
*/
105+
public int size() {
106+
return count;
107+
}
108+
}

0 commit comments

Comments
 (0)