public new void releaseBytes(TLBytes unused) { BytesCache.getInstance().put(unused.getData()); }
/** * Writing tl-bytes value * * @param v value * @param stream destination stream * @throws IOException */ public static void writeTLBytes(TLBytes v, /*OutputStream*/ StreamWriter stream) { try { int startOffset = 1; if (v.getLength() >= 254) { startOffset = 4; writeByte(254, stream); writeByte(v.getLength() & 0xFF, stream); writeByte((v.getLength() >> 8) & 0xFF, stream); writeByte((v.getLength() >> 16) & 0xFF, stream); } else { writeByte(v.getLength(), stream); } writeByteArray(v.getData(), v.getOffset(), v.getLength(), stream); int offset = (v.getLength() + startOffset) % 4; if (offset != 0) { int offsetCount = 4 - offset; writeByteArray(new byte[offsetCount], stream); } } catch(IOException e) { System.Diagnostics.Debug.WriteLine(e.StackTrace); throw e; } }