Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Андрей Смирнов ИТМО КТ stage6 #219

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
33dec72
added first realization
sandrew-uj Feb 20, 2024
4ed27a3
added wrk2
sandrew-uj Feb 21, 2024
215a47c
remove long line
sandrew-uj Feb 21, 2024
b4630db
style fix
sandrew-uj Feb 21, 2024
62ee00a
style fix1
sandrew-uj Feb 21, 2024
474f3f0
added profiling
sandrew-uj Feb 21, 2024
2cd4f41
Merge branch 'main' into main
daniil-ushkov Feb 25, 2024
ea708bc
Merge branch 'main' into main
daniil-ushkov Feb 25, 2024
6197f2f
Merge branch 'polis-vk:main' into main
sandrew-uj Feb 28, 2024
11f2f3f
added stage 2
sandrew-uj Feb 29, 2024
8ba7877
Merge branch 'main' into main
incubos Mar 1, 2024
508c025
codeclimate fix + stage2.md
sandrew-uj Mar 1, 2024
a10c6db
Merge remote-tracking branch 'origin/main'
sandrew-uj Mar 1, 2024
a0aa716
codeclimate fix1
sandrew-uj Mar 1, 2024
dd51faa
Merge branch 'main' into main
sandrew-uj Mar 7, 2024
a3d2c05
fixes in code provided
sandrew-uj Mar 7, 2024
b4e208a
codeclimate fix + added comparing
sandrew-uj Mar 7, 2024
cf7c014
images in md added
sandrew-uj Mar 7, 2024
d816a3a
Merge branch 'main' into main
sandrew-uj Mar 12, 2024
dcdc8d2
executor fix
sandrew-uj Mar 13, 2024
fabb285
style fix
sandrew-uj Mar 13, 2024
3673f33
added better stage readme
sandrew-uj Mar 19, 2024
506da2d
Merge branch 'main' into main
sandrew-uj Mar 19, 2024
1deba38
Merge branch 'main' into main
sandrew-uj Mar 26, 2024
f916e7e
removed unused implements
sandrew-uj Mar 26, 2024
0023be5
Merge remote-tracking branch 'origin/main'
sandrew-uj Mar 26, 2024
fce0383
removed unused import
sandrew-uj Mar 26, 2024
fe005fd
Merge branch 'polis-vk:main' into main
sandrew-uj Mar 29, 2024
8c183e1
Merge branch 'polis-vk:main' into main
sandrew-uj Apr 10, 2024
e50a0e7
Merge branch 'polis-vk:main' into main
sandrew-uj Apr 25, 2024
314cbaa
added solution: try to test on linux
Apr 25, 2024
e5b1014
added solution: local tests passed
Apr 25, 2024
f1df04d
added solution: codeclimate fix
Apr 25, 2024
4505767
added solution: flopping
Apr 25, 2024
fffa6f1
added solution: flopping1
Apr 25, 2024
5c055b1
added report
May 10, 2024
9e190b9
Merge branch 'main' into stage6
sandrew-uj May 10, 2024
096dcac
flopping
May 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package ru.vk.itmo.test.smirnovandrew;
sandrew-uj marked this conversation as resolved.
Show resolved Hide resolved

import ru.vk.itmo.dao.Entry;

import java.lang.foreign.MemorySegment;
import java.lang.foreign.ValueLayout;
import java.nio.charset.StandardCharsets;

public class ChunkTransformUtility {
private static final String CHUNK_SEPARATOR = "\r\n";
private static final String KEY_VALUE_SEPARATOR = "\n";
public static final byte[] EMPTY_CONTENT = "0\r\n\r\n".getBytes(StandardCharsets.UTF_8);
public static final byte[] HEADERS = """
HTTP/1.1 200 OK\r
Content-Type: text/plain\r
Transfer-Encoding: chunked\r
\r
""".getBytes(StandardCharsets.UTF_8);

private ChunkTransformUtility() {

}

public static byte[] makeContent(Entry<MemorySegment> entry) {
int entrySize = (int) (entry.key().byteSize() + entry.value().byteSize()) + KEY_VALUE_SEPARATOR.length();
String entrySizeHex = Long.toHexString(entrySize);
String content = entrySizeHex
+ CHUNK_SEPARATOR
+ new String(entry.key().toArray(ValueLayout.JAVA_BYTE), StandardCharsets.UTF_8)
+ KEY_VALUE_SEPARATOR
+ new String(entry.value().toArray(ValueLayout.JAVA_BYTE), StandardCharsets.UTF_8)
+ CHUNK_SEPARATOR;
return content.getBytes(StandardCharsets.UTF_8);
}
}
Loading
Loading