static boolean handleBackup(RpcWorker worker, byte[] buf, int offset, int payloadSize) throws IOException { if (payloadSize == 0) return writeData(buf, ERR_MISSING_PAYLOAD); final WriteSession session = worker.session; final String name = new String(buf, offset, payloadSize), backupName = worker.backup(name); final StringBuilder sb = new StringBuilder(); if (backupName != null) sb.append("\"Backup completed: ").append(name).append(" @ ").append(backupName).append('"'); else sb.append("\"Backup failed: ").append(name).append('"'); session.sink.writeStrAscii(sb.toString(), session, session.head); return finish(buf, session, true); }
static LinkedBuffer writeTag(final String name, final boolean repeated, final WriteSink sink, final WriteSession session, LinkedBuffer lb) throws IOException { lb = sink.writeStrAscii(name, session, sink.writeByte( EXCLAMATION, session, lb)); if(repeated) return sink.writeByteArray(EMPTY_ARRAY, session, lb); return lb; }
private void writeB64(String name, byte[] value, int offset, int length, boolean repeated) throws IOException { tail = sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByteArray(START_SLASH_TAG, this, sink.writeByteArrayB64(value, offset, length, this, sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByte(START_TAG, this, tail))))))); }
public void writeInt64(int fieldNumber, long value, boolean repeated) throws IOException { final String name = schema.getFieldName(fieldNumber); tail = sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByteArray(START_SLASH_TAG, this, sink.writeStrFromLong(value, this, sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByte(START_TAG, this, tail))))))); }
public void writeFloat(int fieldNumber, float value, boolean repeated) throws IOException { final String name = schema.getFieldName(fieldNumber); tail = sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByteArray(START_SLASH_TAG, this, sink.writeStrFromFloat(value, this, sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByte(START_TAG, this, tail))))))); }
public void writeDouble(int fieldNumber, double value, boolean repeated) throws IOException { final String name = schema.getFieldName(fieldNumber); tail = sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByteArray(START_SLASH_TAG, this, sink.writeStrFromDouble(value, this, sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByte(START_TAG, this, tail))))))); }
public void writeInt32(int fieldNumber, int value, boolean repeated) throws IOException { final String name = schema.getFieldName(fieldNumber); tail = sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByteArray(START_SLASH_TAG, this, sink.writeStrFromInt(value, this, sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByte(START_TAG, this, tail))))))); }
public void writeBool(int fieldNumber, boolean value, boolean repeated) throws IOException { final String name = schema.getFieldName(fieldNumber); tail = sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByteArray(START_SLASH_TAG, this, sink.writeByteArray(value ? TRUE : FALSE, this, sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByte(START_TAG, this, tail))))))); }
public void writeString(int fieldNumber, String value, boolean repeated) throws IOException { final String name = schema.getFieldName(fieldNumber); tail = sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByteArray(START_SLASH_TAG, this, sink.writeStrUTF8(value, this, sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByte(START_TAG, this, tail))))))); }
public <T> void writeObject(int fieldNumber, T value, Schema<T> schema, boolean repeated) throws IOException { final Schema<?> lastSchema = this.schema; this.schema = schema; final String name = lastSchema.getFieldName(fieldNumber); // start tag tail = sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByte(START_TAG, this, tail))); schema.writeTo(this, value); // end tag tail = sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByteArray(START_SLASH_TAG, this, tail))); // restore state this.schema = lastSchema; }
output.sink.writeStrAscii(name, output, output.sink.writeByte(XmlXOutput.START_TAG, output, output.sink.writeByteArray(HEADER, output, output.tail)))); output.sink.writeStrAscii(name, output, output.sink.writeByteArray(XmlXOutput.START_SLASH_TAG, output, output.tail)));
public void writeByteRange(boolean utf8String, int fieldNumber, byte[] value, int offset, int length, boolean repeated) throws IOException { if(!utf8String) { // B64 encode writeB64(schema.getFieldName(fieldNumber), value, offset, length, repeated); return; } // write direct final String name = schema.getFieldName(fieldNumber); tail = sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByteArray(START_SLASH_TAG, this, sink.writeByteArray(value, offset, length, this, sink.writeByte(END_TAG, this, sink.writeStrAscii(name, this, sink.writeByte(START_TAG, this, tail))))))); }
output.sink.writeStrAscii(name, output, output.sink.writeByte(XmlXOutput.START_TAG, output, output.sink.writeByteArray(HEADER, output, output.tail)))); output.sink.writeStrAscii(name, output, output.sink.writeByteArray(XmlXOutput.START_SLASH_TAG, output, output.tail)));
output.sink.writeStrAscii(name, output, output.sink.writeByte(XmlXOutput.START_TAG, output, output.sink.writeByteArray(HEADER, output, output.tail)))); output.sink.writeStrAscii(name, output, output.sink.writeByteArray(XmlXOutput.START_SLASH_TAG, output, output.tail)));
private static LinkedBuffer writeKey(final String name, final int indent, final boolean repeated, final WriteSink sink, final WriteSession session, LinkedBuffer lb) throws IOException { lb = sink.writeByteArray( COLON_AND_SPACE, session, sink.writeStrAscii( name, session, newLine( indent, sink, session, lb))); if(repeated) { return sink.writeByteArray( DASH_AND_SPACE, session, newLine( inc(indent, 2), sink, session, lb)); } return lb; }
output.sink.writeStrAscii(name, output, output.sink.writeByte(XmlXOutput.START_TAG, output, output.sink.writeByteArray(HEADER, output, output.tail)))); output.sink.writeStrAscii(name, output, output.sink.writeByteArray(XmlXOutput.START_SLASH_TAG, output, output.tail)));
keySuffix, this, sink.writeStrAscii( schema.getFieldName(fieldNumber), this, keySuffix, this, sink.writeStrAscii( schema.getFieldName(fieldNumber), this, keySuffix, this, sink.writeStrAscii( schema.getFieldName(fieldNumber), this,