Make readNamedWriteable and writeNamedWriteable public
Now anyone can read or write whatever, whenever. Closes #17682
This commit is contained in:
parent
40b84d2ef6
commit
68b4371bd9
|
@ -34,7 +34,7 @@ public class NamedWriteableAwareStreamInput extends FilterStreamInput {
|
|||
}
|
||||
|
||||
@Override
|
||||
<C extends NamedWriteable<?>> C readNamedWriteable(Class<C> categoryClass) throws IOException {
|
||||
public <C extends NamedWriteable<?>> C readNamedWriteable(Class<C> categoryClass) throws IOException {
|
||||
String name = readString();
|
||||
Writeable.Reader<? extends C> reader = namedWriteableRegistry.getReader(categoryClass, name);
|
||||
C c = reader.read(this);
|
||||
|
|
|
@ -725,7 +725,7 @@ public abstract class StreamInput extends InputStream {
|
|||
* Default implementation throws {@link UnsupportedOperationException} as StreamInput doesn't hold a registry.
|
||||
* Use {@link FilterInputStream} instead which wraps a stream and supports a {@link NamedWriteableRegistry} too.
|
||||
*/
|
||||
<C extends NamedWriteable<?>> C readNamedWriteable(@SuppressWarnings("unused") Class<C> categoryClass) throws IOException {
|
||||
public <C extends NamedWriteable<?>> C readNamedWriteable(@SuppressWarnings("unused") Class<C> categoryClass) throws IOException {
|
||||
throw new UnsupportedOperationException("can't read named writeable from StreamInput");
|
||||
}
|
||||
|
||||
|
|
|
@ -687,7 +687,7 @@ public abstract class StreamOutput extends OutputStream {
|
|||
/**
|
||||
* Writes a {@link NamedWriteable} to the current stream, by first writing its name and then the object itself
|
||||
*/
|
||||
void writeNamedWriteable(NamedWriteable<?> namedWriteable) throws IOException {
|
||||
public void writeNamedWriteable(NamedWriteable<?> namedWriteable) throws IOException {
|
||||
writeString(namedWriteable.getWriteableName());
|
||||
namedWriteable.writeTo(this);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue