本文整理汇总了Java中com.sedmelluq.discord.lavaplayer.tools.io.MessageOutput类的典型用法代码示例。如果您正苦于以下问题:Java MessageOutput类的具体用法?Java MessageOutput怎么用?Java MessageOutput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MessageOutput类属于com.sedmelluq.discord.lavaplayer.tools.io包,在下文中一共展示了MessageOutput类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: encodeTrack
import com.sedmelluq.discord.lavaplayer.tools.io.MessageOutput; //导入依赖的package包/类
@Override
public void encodeTrack(MessageOutput stream, AudioTrack track) throws IOException {
DataOutput output = stream.startMessage();
output.write(TRACK_INFO_VERSION);
AudioTrackInfo trackInfo = track.getInfo();
output.writeUTF(trackInfo.title);
output.writeUTF(trackInfo.author);
output.writeLong(trackInfo.length);
output.writeUTF(trackInfo.identifier);
output.writeBoolean(trackInfo.isStream);
DataFormatTools.writeNullableText(output, trackInfo.uri);
encodeTrackDetails(track, output);
output.writeLong(track.getPosition());
stream.commitMessage(TRACK_INFO_VERSIONED);
}
示例2: SerializedTrack
import com.sedmelluq.discord.lavaplayer.tools.io.MessageOutput; //导入依赖的package包/类
public SerializedTrack(Track track) {
this.dj = track.dj;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
MessageOutput mo = new MessageOutput(baos);
try {
GabrielBot.getInstance().playerManager.encodeTrack(mo, track.track.makeClone());
} catch(IOException e) {
throw new AssertionError(e);
}
this.track = baos.toByteArray();
}
示例3: serialize
import com.sedmelluq.discord.lavaplayer.tools.io.MessageOutput; //导入依赖的package包/类
@BotCommandHandler
private void serialize(Message message) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
MessageOutput outputStream = new MessageOutput(baos);
for (AudioTrack track : scheduler.drainQueue()) {
manager.encodeTrack(outputStream, track);
}
outputStream.finish();
message.getChannel().sendMessage(Base64.encodeBytes(baos.toByteArray())).queue();
}
示例4: toMessage
import com.sedmelluq.discord.lavaplayer.tools.io.MessageOutput; //导入依赖的package包/类
public static String toMessage(AudioTrack track) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Player.PLAYER_MANAGER.encodeTrack(new MessageOutput(baos), track);
return Base64.encodeBase64String(baos.toByteArray());
}
示例5: toMessage
import com.sedmelluq.discord.lavaplayer.tools.io.MessageOutput; //导入依赖的package包/类
public static String toMessage(AudioTrack track) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PLAYER_MANAGER.encodeTrack(new MessageOutput(baos), track);
return new String(Base64.encodeBytesToBytes(baos.toByteArray()));
}
示例6: encodeTrack
import com.sedmelluq.discord.lavaplayer.tools.io.MessageOutput; //导入依赖的package包/类
/**
* Encode a track into an output stream. If the decoder is not supposed to know the number of tracks in advance, then
* the encoder should call MessageOutput#finish() after all the tracks it wanted to write have been written. This will
* make decodeTrack() return null at that position
*
* @param stream The message stream to write it to.
* @param track The track to encode.
* @throws IOException On IO error.
*/
void encodeTrack(MessageOutput stream, AudioTrack track) throws IOException;