Package com.samskivert.io

Examples of com.samskivert.io.ByteArrayOutInputStream


     * @return true if the update was successful, false if it failed due to the stat being
     * simultaneously modified by another database client.
     */
    protected boolean updateStat (int playerId, final Stat stat, boolean forceWrite)
    {
        ByteArrayOutInputStream out = new ByteArrayOutInputStream();
        try {
            stat.persistTo(new ObjectOutputStream(out), this);
        } catch (IOException ioe) {
            throw new DatabaseException("Error serializing stat " + stat, ioe);
        }

        byte[] data = out.toByteArray();
        byte nextModCount = (byte)((stat.getModCount() + 1) % Byte.MAX_VALUE);
        Key<StatRecord> key = StatRecord.getKey(playerId, stat.getCode());

        // update the row in the database only if it has the expected modCount
        int numRows = updatePartial(
View Full Code Here

TOP

Related Classes of com.samskivert.io.ByteArrayOutInputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.