本文整理汇总了Java中com.sedmelluq.discord.lavaplayer.tools.io.MessageInput类的典型用法代码示例。如果您正苦于以下问题:Java MessageInput类的具体用法?Java MessageInput怎么用?Java MessageInput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MessageInput类属于com.sedmelluq.discord.lavaplayer.tools.io包,在下文中一共展示了MessageInput类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decodeTrack
import com.sedmelluq.discord.lavaplayer.tools.io.MessageInput; //导入依赖的package包/类
@Override
public DecodedTrackHolder decodeTrack(MessageInput stream) throws IOException {
DataInput input = stream.nextMessage();
if (input == null) {
return null;
}
int version = (stream.getMessageFlags() & TRACK_INFO_VERSIONED) != 0 ? (input.readByte() & 0xFF) : 1;
AudioTrackInfo trackInfo = new AudioTrackInfo(input.readUTF(), input.readUTF(), input.readLong(), input.readUTF(),
input.readBoolean(), version >= 2 ? DataFormatTools.readNullableText(input) : null);
AudioTrack track = decodeTrackDetails(trackInfo, input);
long position = input.readLong();
if (track != null) {
track.setPosition(position);
}
stream.skipRemainingBytes();
return new DecodedTrackHolder(track);
}
示例2: deserialize
import com.sedmelluq.discord.lavaplayer.tools.io.MessageInput; //导入依赖的package包/类
@BotCommandHandler
private void deserialize(Message message, String content) throws IOException {
outputChannel.set((TextChannel) message.getChannel());
connectToFirstVoiceChannel(guild.getAudioManager());
byte[] bytes = Base64.decode(content);
MessageInput inputStream = new MessageInput(new ByteArrayInputStream(bytes));
DecodedTrackHolder holder;
while ((holder = manager.decodeTrack(inputStream)) != null) {
if (holder.decodedTrack != null) {
scheduler.addToQueue(holder.decodedTrack);
}
}
}
示例3: toAudioTrack
import com.sedmelluq.discord.lavaplayer.tools.io.MessageInput; //导入依赖的package包/类
public static AudioTrack toAudioTrack(String message) throws IOException {
byte[] b64 = Base64.decodeBase64(message);
ByteArrayInputStream bais = new ByteArrayInputStream(b64);
return Player.PLAYER_MANAGER.decodeTrack(new MessageInput(bais)).decodedTrack;
}
示例4: toAudioTrack
import com.sedmelluq.discord.lavaplayer.tools.io.MessageInput; //导入依赖的package包/类
public static AudioTrack toAudioTrack(String message) throws IOException {
byte[] b64 = Base64.decode(message);
ByteArrayInputStream bais = new ByteArrayInputStream(b64);
return PLAYER_MANAGER.decodeTrack(new MessageInput(bais)).decodedTrack;
}
示例5: decodeTrack
import com.sedmelluq.discord.lavaplayer.tools.io.MessageInput; //导入依赖的package包/类
/**
* Decode a track from an input stream. Null returns value indicates reaching the position where the decoder had
* called MessageOutput#finish().
*
* @param stream The message stream to read it from.
* @return Holder containing the track if it was successfully decoded.
* @throws IOException On IO error.
*/
DecodedTrackHolder decodeTrack(MessageInput stream) throws IOException;