org.lwes.serializer.DeserializerState Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lwes-java Show documentation
Show all versions of lwes-java Show documentation
Lightweight event system, java implementation
The newest version!
/*======================================================================*
* Copyright (c) 2008, Yahoo! Inc. All rights reserved. *
* *
* Licensed under the New BSD License (the "License"); you may not use *
* this file except in compliance with the License. Unless required *
* by applicable law or agreed to in writing, software distributed *
* under the License is distributed on an "AS IS" BASIS, WITHOUT *
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. See accompanying LICENSE file. *
*======================================================================*/
package org.lwes.serializer;
/**
* An internal class used by the Deserializer to keep track of its state
*
* @author Anthony Molinaro
*/
public class DeserializerState
{
private int index;
/**
* Constructor
*/
public DeserializerState()
{
index = 0;
}
/**
* Constructor
*/
public DeserializerState(int i)
{
index = i;
}
/**
* Increments the index into a byte array, by a specified amount
* and returns the new index value.
*
* @param amount the amount to increment by
* @return the new index value as an int
*/
public int incr(int amount)
{
index += amount;
return index;
}
/**
* return the current index
*
* @return the current index as an int
*/
public int currentIndex()
{
return index;
}
/**
* reset the object to a clean state
*
*/
public void reset()
{
index = 0;
}
/**
* Returns a String representation of this object
* Overrides method in Object
*
* @return a String return of this object.
*/
@Override
public String toString()
{
return "DeserializeState = "+index;
}
public void set(int index) {
this.index = index;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy