Java Code Examples for skadistats.clarity.source.Source#skipBytes()

The following examples show how to use skadistats.clarity.source.Source#skipBytes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CsGoEngineType.java    From clarity with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public <T extends GeneratedMessage> PacketInstance<T> getNextPacketInstance(final Source source) throws IOException {
    final int kind = source.readByte() & 0xFF;
    final int tick = source.readFixedInt32();
    source.skipBytes(1); // playerSlot
    if (kind > handlers.length) {
        throw new UnsupportedOperationException("kind " + kind + " not implemented");
    }
    final Handler<T> handler = (Handler<T>) handlers[kind - 1];
    return new PacketInstance<T>() {
        @Override
        public int getKind() {
            return kind;
        }
        @Override
        public int getTick() {
            return tick;
        }
        @Override
        public Class<T> getMessageClass() {
            return handler.clazz;
        }
        @Override
        public ResetRelevantKind getResetRelevantKind() {
            return handler.resetRelevantKind;
        }
        @Override
        public T parse() throws IOException {
            return handler.parse(source);
        }
        @Override
        public void skip() throws IOException {
            handler.skip(source);
        }
    };
}
 
Example 2
Source File: DotaS1EngineType.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void readHeader(Source source) throws IOException {
    source.skipBytes(4);
}
 
Example 3
Source File: DotaS1EngineType.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void skipHeader(Source source) throws IOException {
    source.skipBytes(4);
}
 
Example 4
Source File: AbstractDotaEngineType.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public <T extends GeneratedMessage> PacketInstance<T> getNextPacketInstance(final Source source) throws IOException {
    int rawKind = source.readVarInt32();
    final boolean isCompressed = (rawKind & getCompressedFlag()) == getCompressedFlag();
    final int kind = rawKind &~ getCompressedFlag();
    final int tick = source.readVarInt32();
    final int size = source.readVarInt32();
    final Class<T> messageClass = (Class<T>) DemoPackets.classForKind(kind);
    return new PacketInstance<T>() {

        @Override
        public int getKind() {
            return kind;
        }

        @Override
        public int getTick() {
            return tick;
        }

        @Override
        public Class<T> getMessageClass() {
            return messageClass;
        }

        @Override
        public ResetRelevantKind getResetRelevantKind() {
            switch(kind) {
                case Demo.EDemoCommands.DEM_SyncTick_VALUE:
                    return ResetRelevantKind.SYNC;
                case Demo.EDemoCommands.DEM_StringTables_VALUE:
                    return ResetRelevantKind.STRINGTABLE;
                case Demo.EDemoCommands.DEM_FullPacket_VALUE:
                    return ResetRelevantKind.FULL_PACKET;
                default:
                    return null;
            }
        }

        @Override
        public T parse() throws IOException {
            return Packet.parse(
                    messageClass,
                    ZeroCopy.wrap(packetReader.readFromSource(source, size, isCompressed))
            );
        }

        @Override
        public void skip() throws IOException {
            source.skipBytes(size);
        }
    };
}
 
Example 5
Source File: CsGoEngineType.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void skipHeader(Source source) throws IOException {
    source.skipBytes(1064);
}
 
Example 6
Source File: CsGoEngineType.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void skipPacket(Source source) throws IOException {
    source.skipBytes(source.readFixedInt32());
}
 
Example 7
Source File: CsGoEngineType.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void readCommandInfo(Source source) throws IOException {
    source.skipBytes(152);
}
 
Example 8
Source File: CsGoEngineType.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void skipCommandInfo(Source source) throws IOException {
    source.skipBytes(152);
}
 
Example 9
Source File: CsGoEngineType.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void skip(Source source) throws IOException {
    skipCommandInfo(source);
    source.skipBytes(8);
    skipPacket(source);
}
 
Example 10
Source File: CsGoEngineType.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void skip(Source source) throws IOException {
    source.skipBytes(4);
    skipPacket(source);
}
 
Example 11
Source File: DotaS2EngineType.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void readHeader(Source source) throws IOException {
    source.skipBytes(8);
}
 
Example 12
Source File: DotaS2EngineType.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void skipHeader(Source source) throws IOException {
    source.skipBytes(8);
}