@Override public final boolean equals(Object o) { return o instanceof Span && equals((Span) o); }
/** Default constructor */ public Span() { init(); }
/** * Deserializes the object. * @param buf the data source. * @param offset the initial index for {@code buf}, inclusive. * @return the final index for {@code buf}, exclusive. * @throws BufferUnderflowException when {@code buf} is incomplete. (EOF) * @throws SecurityException on an upper limit breach defined by {@link #colferSizeMax}. * @throws InputMismatchException when the data does not match this object's schema. */ public int unmarshal(byte[] buf, int offset) { return unmarshal(buf, offset, buf.length); }
private void writeObject(ObjectOutputStream out) throws IOException { // TODO: better size estimation byte[] buf = new byte[1024]; int n; while (true) try { n = marshal(buf, 0); break; } catch (BufferUnderflowException e) { buf = new byte[4 * buf.length]; } out.writeInt(n); out.write(buf, 0, n); }
private void writeObject(ObjectOutputStream out) throws IOException { // TODO: better size estimation byte[] buf = new byte[1024]; int n; while (true) try { n = marshal(buf, 0); break; } catch (BufferUnderflowException e) { buf = new byte[4 * buf.length]; } out.writeInt(n); out.write(buf, 0, n); }
/** Default constructor */ public Span() { init(); }
/** * Serializes the object. * @param out the data destination. * @param buf the initial buffer or {@code null}. * @return the final buffer. When the serial fits into {@code buf} then the return is {@code buf}. * Otherwise the return is a new buffer, large enough to hold the whole serial. * @throws IOException from {@code out}. * @throws IllegalStateException on an upper limit breach defined by {@link #colferSizeMax}. */ public byte[] marshal(OutputStream out, byte[] buf) throws IOException { // TODO: better size estimation if (buf == null || buf.length == 0) buf = new byte[Math.min(Span.colferSizeMax, 2048)]; while (true) { int i; try { i = marshal(buf, 0); } catch (BufferOverflowException e) { buf = new byte[Math.min(Span.colferSizeMax, buf.length * 4)]; continue; } out.write(buf, 0, i); return buf; } }
/** * Deserializes the object. * @param buf the data source. * @param offset the initial index for {@code buf}, inclusive. * @return the final index for {@code buf}, exclusive. * @throws BufferUnderflowException when {@code buf} is incomplete. (EOF) * @throws SecurityException on an upper limit breach defined by {@link #colferSizeMax}. * @throws InputMismatchException when the data does not match this object's schema. */ public int unmarshal(byte[] buf, int offset) { return unmarshal(buf, offset, buf.length); }
@Override public final boolean equals(Object o) { return o instanceof Span && equals((Span) o); }
private void readObjectNoData() throws ObjectStreamException { init(); }
/** * Serializes the object. * @param out the data destination. * @param buf the initial buffer or {@code null}. * @return the final buffer. When the serial fits into {@code buf} then the return is {@code buf}. * Otherwise the return is a new buffer, large enough to hold the whole serial. * @throws IOException from {@code out}. * @throws IllegalStateException on an upper limit breach defined by {@link #colferSizeMax}. */ public byte[] marshal(OutputStream out, byte[] buf) throws IOException { // TODO: better size estimation if (buf == null || buf.length == 0) buf = new byte[Math.min(Span.colferSizeMax, 2048)]; while (true) { int i; try { i = marshal(buf, 0); } catch (BufferOverflowException e) { buf = new byte[Math.min(Span.colferSizeMax, buf.length * 4)]; continue; } out.write(buf, 0, i); return buf; } }
private void readObjectNoData() throws ObjectStreamException { init(); }