Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikpro200125 committed Feb 18, 2024
1 parent e767b9f commit b0a346e
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/main/java/ru/vk/itmo/test/nikitaprokopev/MyServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.lang.foreign.ValueLayout;
import java.nio.charset.StandardCharsets;


public class MyServer extends HttpServer {

private static final long FLUSH_THRESHOLD_BYTES = 2 * 1024 * 1024; // 2 MB
Expand Down Expand Up @@ -62,7 +61,7 @@ public Response put(@Param(value = "id", required = true) String id, Request req

Entry<MemorySegment> entry = new BaseEntry<>(
msKey,
toMemorySegment(request.getBody())
MemorySegment.ofArray(request.getBody())
);

dao.upsert(entry);
Expand Down Expand Up @@ -115,10 +114,6 @@ private MemorySegment toMemorySegment(String s) {
return MemorySegment.ofArray(s.getBytes(StandardCharsets.UTF_8));
}

private MemorySegment toMemorySegment(byte[] bytes) {
return MemorySegment.ofArray(bytes);
}

private byte[] toByteArray(MemorySegment ms) {
return ms.toArray(ValueLayout.JAVA_BYTE);
}
Expand Down

0 comments on commit b0a346e

Please sign in to comment.