org.redkalex.convert.pson.ProtobufStreamWriter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of redkale-plugins Show documentation
Show all versions of redkale-plugins Show documentation
Redkale-Plugins -- java framework
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkalex.convert.pson;
import java.io.*;
import org.redkale.convert.*;
/**
*
* 详情见: https://redkale.org
*
* @author zhangjx
*/
class ProtobufStreamWriter extends ProtobufByteBufferWriter {
private OutputStream out;
protected ProtobufStreamWriter(boolean tiny, OutputStream out) {
super(tiny, null);
this.out = out;
}
@Override
protected boolean recycle() {
super.recycle();
this.out = null;
return false;
}
@Override
public void writeTo(final byte[] chs, final int start, final int len) {
try {
out.write(chs, start, len);
} catch (IOException e) {
throw new ConvertException(e);
}
}
@Override
public void writeTo(final byte ch) {
try {
out.write((byte) ch);
} catch (IOException e) {
throw new ConvertException(e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy