ti.modules.titanium
Class BufferProxy

java.lang.Object
  extended by org.appcelerator.kroll.KrollProxy
      extended by ti.modules.titanium.BufferProxy
All Implemented Interfaces:
Handler.Callback, org.appcelerator.kroll.KrollProxySupport

@Kroll.proxy(creatableInModule=ti.modules.titanium.TitaniumModule.class,
             propertyAccessors={"byteOrder","type","value"})
public class BufferProxy
extends KrollProxy

A proxy that wraps a primitive byte array buffer


Method Summary
 byte[] getBuffer()
           
 int getLength()
           
 void setLength(int length)
          Sets the length of this buffer proxy by either growing or shrinking the allocated buffer space
 int write(int position, byte[] sourceBuffer, int sourceOffset, int sourceLength)
          Writes data from sourceBuffer into this.
 
Methods inherited from class org.appcelerator.kroll.KrollProxy
fireEvent, fireSyncEvent, getActivity, getCreationUrl, getKrollObject, getLangConversionTable, getProperties, getProperty, handleDefaultValues, hasListeners, hasProperty, resolveUrl, setModelListener, setProperty, setPropertyAndFire
 

Method Detail

getBuffer

public byte[] getBuffer()
Returns:
The native buffer for this proxy

write

public int write(int position,
                 byte[] sourceBuffer,
                 int sourceOffset,
                 int sourceLength)
Writes data from sourceBuffer into this.

Parameters:
position - the offset position of this buffer.
sourceBuffer - the source buffer to write from.
sourceOffset - the offset position of the sourceBuffer.
sourceLength - the length of the sourceBuffer.
Returns:
number of bytes written, -1 if no data is available.

getLength

@Kroll.getProperty
@Kroll.method
public int getLength()
Returns:
The length of this buffer in bytes

setLength

@Kroll.setProperty
@Kroll.method
public void setLength(int length)
Sets the length of this buffer proxy by either growing or shrinking the allocated buffer space

Parameters:
length - The new length of this buffer proxy in bytes


Copyright © 2010-2012 Appcelerator, Inc. Licensed under the Apache License 2.0