All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.pgasync.impl.io.NotificationResponseDecoder Maven / Gradle / Ivy

There is a newer version: 0.9
Show newest version
package com.github.pgasync.impl.io;

import com.github.pgasync.impl.message.NotificationResponse;

import java.nio.ByteBuffer;

import static com.github.pgasync.impl.io.IO.getCString;

/**
 * See PostgreSQL message formats
 *
 * 
 * NotificationResponse (B)
 *  Byte1('A')
 *      Identifies the message as a notification response.
 *  Int32
 *      Length of message contents in bytes, including self.
 *  Int32
 *      The process ID of the notifying backend process.
 *  String
 *      The name of the channel that the notify has been raised on.
 *  String
 *      The "payload" string passed from the notifying process.
 * 
* * @author Antti Laisi */ public class NotificationResponseDecoder implements Decoder { @Override public NotificationResponse read(ByteBuffer buffer) { byte[] chars = new byte[255]; return new NotificationResponse(buffer.getInt(), getCString(buffer, chars), getCString(buffer, chars)); } @Override public byte getMessageId() { return 'A'; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy