public void writeObjectUnshared(final Object obj) throws IOException { doWriteObject(obj, true); }
public void write(final int v) throws IOException { final byte[] buffer = this.buffer; final int remaining = buffer.length - position; if (remaining == 0) { flush(); buffer[0] = (byte) v; position = 1; } else { buffer[position++] = (byte) v; } }
public void write(final byte[] b) throws IOException { write(b, 0, b.length); }
public void writeUTF(final String s) throws IOException { final int len = UTFUtils.getShortUTFLength(s); final int position = this.position; final int bufsize = buffer.length; int remaining = bufsize - position; if (len > bufsize >> 1 || len + 2 > remaining) { // the string will take up more than half the buffer or it is bigger than the remaining space // so don't bother double-buffering this block flush(); if (len < 253) { serialMarshaller.write(TC_BLOCKDATA); serialMarshaller.write(len + 2); serialMarshaller.writeShort(len); UTFUtils.writeUTFBytes(serialMarshaller, s); } else { serialMarshaller.write(TC_BLOCKDATALONG); serialMarshaller.writeInt(len + 2); serialMarshaller.writeShort(len); UTFUtils.writeUTFBytes(serialMarshaller, s); } } else { // the string will fit in this buffer writeShort(len); UTFUtils.writeUTFBytes(this, s); } }
public void start(final ByteOutput byteOutput) throws IOException { blockMarshaller = new BlockMarshaller(this, bufferSize < MIN_BUFFER_SIZE ? MIN_BUFFER_SIZE : bufferSize); super.start(byteOutput); writeShort(configuredVersion); }
public void writeChars(final String s) throws IOException { final int len = s.length(); for (int i = 0; i < len; i ++) { writeChar(s.charAt(i)); } }
public void writeUTF(final String s) throws IOException { final int len = UTFUtils.getShortUTFLength(s); final int position = this.position; final int bufsize = buffer.length; int remaining = bufsize - position; if (len > bufsize >> 1 || len + 2 > remaining) { // the string will take up more than half the buffer or it is bigger than the remaining space // so don't bother double-buffering this block flush(); if (len < 253) { serialMarshaller.write(TC_BLOCKDATA); serialMarshaller.write(len + 2); serialMarshaller.writeShort(len); UTFUtils.writeUTFBytes(serialMarshaller, s); } else { serialMarshaller.write(TC_BLOCKDATALONG); serialMarshaller.writeInt(len + 2); serialMarshaller.writeShort(len); UTFUtils.writeUTFBytes(serialMarshaller, s); } } else { // the string will fit in this buffer writeShort(len); UTFUtils.writeUTFBytes(this, s); } }
public void start(final ByteOutput byteOutput) throws IOException { blockMarshaller = new BlockMarshaller(this, bufferSize < MIN_BUFFER_SIZE ? MIN_BUFFER_SIZE : bufferSize); super.start(byteOutput); writeShort(configuredVersion); }
public void writeChars(final String s) throws IOException { final int len = s.length(); for (int i = 0; i < len; i ++) { writeChar(s.charAt(i)); } }
public void writeByte(final int v) throws IOException { final byte[] buffer = this.buffer; final int remaining = buffer.length - position; if (remaining == 0) { flush(); buffer[0] = (byte) v; position = 1; } else { buffer[position++] = (byte) v; } }
public void writeUTF(final String s) throws IOException { final int len = UTFUtils.getShortUTFLength(s); final int position = this.position; final int bufsize = buffer.length; int remaining = bufsize - position; if (len > bufsize >> 1 || len + 2 > remaining) { // the string will take up more than half the buffer or it is bigger than the remaining space // so don't bother double-buffering this block flush(); if (len < 253) { serialMarshaller.write(TC_BLOCKDATA); serialMarshaller.write(len + 2); serialMarshaller.writeShort(len); UTFUtils.writeUTFBytes(serialMarshaller, s); } else { serialMarshaller.write(TC_BLOCKDATALONG); serialMarshaller.writeInt(len + 2); serialMarshaller.writeShort(len); UTFUtils.writeUTFBytes(serialMarshaller, s); } } else { // the string will fit in this buffer writeShort(len); UTFUtils.writeUTFBytes(this, s); } }
public void write(final byte[] b) throws IOException { write(b, 0, b.length); }
public void writeObject(final Object obj) throws IOException { doWriteObject(obj, false); }
public void start(final ByteOutput byteOutput) throws IOException { blockMarshaller = new BlockMarshaller(this, bufferSize < MIN_BUFFER_SIZE ? MIN_BUFFER_SIZE : bufferSize); super.start(byteOutput); writeShort(configuredVersion); }
public void writeChars(final String s) throws IOException { final int len = s.length(); for (int i = 0; i < len; i ++) { writeChar(s.charAt(i)); } }
public void writeBoolean(final boolean v) throws IOException { final byte[] buffer = this.buffer; final int remaining = buffer.length - position; if (remaining == 0) { flush(); buffer[0] = (byte) (v ? 1 : 0); position = 1; } else { buffer[position++] = (byte) (v ? 1 : 0); } }
public void writeUTF(final String s) throws IOException { final int len = UTFUtils.getShortUTFLength(s); final int position = this.position; final int bufsize = buffer.length; int remaining = bufsize - position; if (len > bufsize >> 1 || len + 2 > remaining) { // the string will take up more than half the buffer or it is bigger than the remaining space // so don't bother double-buffering this block flush(); if (len < 253) { serialMarshaller.write(TC_BLOCKDATA); serialMarshaller.write(len + 2); serialMarshaller.writeShort(len); UTFUtils.writeUTFBytes(serialMarshaller, s); } else { serialMarshaller.write(TC_BLOCKDATALONG); serialMarshaller.writeInt(len + 2); serialMarshaller.writeShort(len); UTFUtils.writeUTFBytes(serialMarshaller, s); } } else { // the string will fit in this buffer writeShort(len); UTFUtils.writeUTFBytes(this, s); } }
public void write(final byte[] b) throws IOException { write(b, 0, b.length); }
public void writeObjectUnshared(final Object obj) throws IOException { doWriteObject(obj, true); }
public void start(final ByteOutput byteOutput) throws IOException { blockMarshaller = new BlockMarshaller(this, bufferSize < MIN_BUFFER_SIZE ? MIN_BUFFER_SIZE : bufferSize); super.start(byteOutput); writeShort(configuredVersion); }