-
Notifications
You must be signed in to change notification settings - Fork 38
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
[1.20.2] Endec - Simplier Codec Alternative #184
Changes from 13 commits
f6d935b
7ac9a08
dd47bef
e13e5c3
e090877
cb59dbc
8559f26
440e0be
f6c017d
2a9e5bd
7336ee7
08cde20
cfdfc6b
2247a50
d14078f
3bcfaca
342aefa
ed9d552
1b3b887
7d71fec
6a7d27e
a6588c6
797d059
7ba7a8a
5251110
192dae0
e4f8808
269f57a
9508b19
9b0cc57
9a6edbe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package io.wispforest.owo.serialization; | ||
|
||
import io.wispforest.owo.serialization.impl.SerializationAttribute; | ||
|
||
import java.util.Optional; | ||
import java.util.Set; | ||
|
||
public interface Deserializer<T> { | ||
|
||
Set<SerializationAttribute> attributes(); | ||
|
||
<V> Optional<V> readOptional(Endec<V> endec); | ||
|
||
boolean readBoolean(); | ||
|
||
byte readByte(); | ||
|
||
short readShort(); | ||
|
||
int readInt(); | ||
|
||
long readLong(); | ||
|
||
float readFloat(); | ||
|
||
double readDouble(); | ||
|
||
String readString(); | ||
|
||
byte[] readBytes(); | ||
|
||
int readVarInt(); | ||
|
||
long readVarLong(); | ||
|
||
<E> SequenceDeserializer<E> sequence(Endec<E> elementEndec); | ||
|
||
<V> MapDeserializer<V> map(Endec<V> valueEndec); | ||
|
||
StructDeserializer struct(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package io.wispforest.owo.serialization; | ||
|
||
/** | ||
* Interface that indicates that the object has an end operation to such | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMHO it would be nicer to just make an interface that extends AutoCloseable and just makes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possibly a good idea as such exists just as a way to prevent issues with calling close method and |
||
public interface Endable extends AutoCloseable { | ||
|
||
void end(); | ||
|
||
@Override default void close(){ end(); } | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be updated to use a proper MapEndec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly