//
//  SendBuffer.m
//  OkeyiPhoneClient
//
//  Original development by Infosfer Game Technologies Ltd. | http://www.infosfer.com.
//
//  Maintained and developed by A51 Integrated.
//  Copyright 2012 A51 Integrated | http://a51integrated.com. All rights reserved.
//

#import "SendBuffer.h"

@implementation SendBuffer

@synthesize sendPos;

+ (id)dataWithNSData:(NSData *)newData;
{
	SendBuffer *obj = [SendBuffer alloc];
	return [obj initWithData:newData];
}

- (id)initWithData:(NSData *)newData
{
	self = [super init];
    if (self) {
		embeddedData = [NSMutableData dataWithData:newData];
		sendPos = 0;
	}
	
	return self;
}

- (void)consumeData:(NSInteger)length {
	sendPos += length;
}


- (const void *)bytes
{
	return [embeddedData bytes];
}

- (NSUInteger)length
{
	return [embeddedData length];
}

- (void *)mutableBytes
{
	return [embeddedData mutableBytes];
}

- (void)setLength:(NSUInteger)length
{
	[embeddedData setLength:length];
}

@end
