Java Doc for FlashBuffer.java in  » Ajax » Laszlo-4.0.10 » org » openlaszlo » iv » flash » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Ajax » Laszlo 4.0.10 » org.openlaszlo.iv.flash.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.openlaszlo.iv.flash.util.FlashBuffer

All known Subclasses:   org.openlaszlo.iv.flash.util.FlashOutput,  org.openlaszlo.iv.flash.parser.Parser,
FlashBuffer
public class FlashBuffer (Code)
Wrapper of array of bytes.

Provides reading and writing of flash related data types.
author:
   Dmitry Skavish
See Also:   FlashOutput


Inner Class :public class FlashBufferInputStream extends InputStream
Inner Class :public class FlashBufferOutputStream extends OutputStream

Field Summary
public  intpos
    

Constructor Summary
public  FlashBuffer()
    
public  FlashBuffer(int capacity)
     Allocates buffer of given capacity.

Sets current position and size to zero.

public  FlashBuffer(byte[] buf)
     Creates buffer from given one.

Sets current position to zero and size to the size of the buffer.

public  FlashBuffer(byte[] buf, int size)
     Creates buffer from given one of specified size.

Sets current position to zero and size to given value.

public  FlashBuffer(byte[] buf, int pos, int size)
     Creates buffer from given one of specified size and position.
public  FlashBuffer(InputStream is)
     Creates FlashBuffer from input stream.

Reads InputStream into the buffer, sets current position to zero and size to the size of data read.


Method Summary
final public  void_writeArray(byte b, int off, int len)
     Writes array into this one and advance current position.
final public  void_writeByte(int b)
     Writes byte and advance current position.
final public  void_writeDWord(int b)
     Writes dword and advance current position.
final public  byte[]_writeStringZ(String s)
     Writes zero-ending string into the buffer and advance current position.
final public  byte[]_writeStringZ(String s, String encoding)
     Writes zero-ending string into the buffer and advance current position.
final public  void_writeWord(int b)
     Writes word and advance current position.
final public  voidensureCapacity(int cap)
    
final public  voidflushBits()
    
final public  intgetBits(int n)
     Reads unsigned bits from the buffer.

According to profiler this is probably the most time consuming operation.

public  booleangetBool()
    
final public  byte[]getBuf()
     Returns the whole buffer.
final public  intgetByte()
     Reads one signed byte.
final public  intgetByteAt(int p)
    
final public  byte[]getBytes(int length)
     Reads bytes into array of bytes.
public  FlashBuffergetCopy()
     Creates copy of the buffer.
public  intgetDWord()
     Reads one signed dword.
public  intgetDWordAt(int p)
    
public  InputStreamgetInputStream()
     Creates input stream which can be used to read data from this buffer.
public  InputStreamgetInputStream(int pos)
     Creates input stream which can be used to read data from this buffer.
public  AffineTransformgetMatrix()
    
public  OutputStreamgetOutputStream()
     Creates output stream which can be used to write data to this buffer.
final public  intgetPos()
     Current read/write position.
public  Rectangle2DgetRect()
    
final public  intgetSBits(int n)
    
final public  intgetSize()
     Returns size of the buffer.
final public  StringgetString()
     Reads zero-ending string.
final public  StringgetString(int length)
     Read string by its length.
final public  voidgetTo(FlashBuffer fob, int length)
     Reads bytes into given FlashBuffer.
final public  intgetUByte()
     Reads one unsigned byte.
final public  intgetUByteAt(int p)
    
public  intgetUDWord()
     Reads one unsigned dword.
public  intgetUDWordAt(int p)
    
final public  intgetUWord()
     Reads one unsigned word.
final public  intgetUWordAt(int p)
    
final public  intgetWord()
     Reads one signed word.
final public  intgetWordAt(int p)
    
final public  voidincPos()
     Increment current position.

Does not increase the buffer if new position is larger than current capacity.

public  voidinit(byte[] buf, int pos, int size)
    
final public  voidinitBits()
    
final public  intnew_getBits(int n)
    
final public  voidsetPos(int pos)
     Sets current read/write position.

Does not increase the buffer if new position is larger than current capacity.

final public  voidsetSize(int size)
     Sets new size of the buffer.

Does not increase the buffer if new position is larger than current capacity.

final public  voidskip(int inc)
     Skips bytes (changes current position).

Does not increase the buffer if new position is larger than current capacity.

final public  voidskipBits(int n)
     Skips bits.
public  voidskipMatrix()
    
public  voidskipRect()
    
public  StringtoString()
    
public  StringtoString(String encoding)
    
final public  voidwrite(InputStream is)
    
public  voidwrite(AffineTransform m)
    
public  voidwrite(Rectangle2D r)
    
final public  voidwriteArray(byte b, int off, int len)
     Writes array into this one and advance current position.
final public  voidwriteBit(int b)
     Writes lower bit to bit buffer.
final public  voidwriteBits(int v, int len)
    
final public  voidwriteBool(boolean b)
     Writes boolean as a bit to bit buffer.
final public  voidwriteByte(int b)
     Writes byte and advance current position.
final public  voidwriteByteAt(int b, int pos)
     Writes byte at specified position.

Does not change current position.

final public  voidwriteDWord(int b)
     Writes dword and advance current position.
final public  voidwriteDWordAt(int b, int pos)
     Writes dword at specified position.

Does not change current position.

final public  voidwriteFOB(FlashBuffer fob)
     Writes FlashBuffer into this one and advance current position.
final public  voidwriteLongTag(int tagCode, int tagSize)
    
final public  voidwriteLongTagAt(int tagCode, int tagSize, int pos)
    
final public  voidwriteShortTagAt(int tagCode, int tagSize, int pos)
    
final public  voidwriteStringL(String s)
     Writes length-prefixed string into the buffer and advance current position.
final public  voidwriteStringL(String s, String encoding)
     Writes length-prefixed string into the buffer and advance current position.
final public  byte[]writeStringZ(String s)
     Writes zero-ending string into the buffer and advance current position.
final public  byte[]writeStringZ(String s, String encoding)
     Writes zero-ending string into the buffer and advance current position.
final public  voidwriteTag(int tagCode, int tagSize)
    
final public  voidwriteWord(int b)
     Writes word and advance current position.
final public  voidwriteWordAt(int b, int pos)
     Writes word at specified position.

Does not change current position.


Field Detail
pos
public int pos(Code)




Constructor Detail
FlashBuffer
public FlashBuffer()(Code)



FlashBuffer
public FlashBuffer(int capacity)(Code)
Allocates buffer of given capacity.

Sets current position and size to zero.
Parameters:
  capacity - capacity of allocated buffer in bytes




FlashBuffer
public FlashBuffer(byte[] buf)(Code)
Creates buffer from given one.

Sets current position to zero and size to the size of the buffer.
Parameters:
  buf - buffer to init from




FlashBuffer
public FlashBuffer(byte[] buf, int size)(Code)
Creates buffer from given one of specified size.

Sets current position to zero and size to given value.
Parameters:
  buf - buffer to init from
Parameters:
  size - size of buffer




FlashBuffer
public FlashBuffer(byte[] buf, int pos, int size)(Code)
Creates buffer from given one of specified size and position.
Parameters:
  buf - buffer to init from
Parameters:
  pos - current position
Parameters:
  size - size of filled buffer (writer pos)



FlashBuffer
public FlashBuffer(InputStream is) throws IOException(Code)
Creates FlashBuffer from input stream.

Reads InputStream into the buffer, sets current position to zero and size to the size of data read.
author:
   Andrew Wason
author:
   Dmitry Skavish
Parameters:
  is - InputStream to read from
exception:
  IOException -





Method Detail
_writeArray
final public void _writeArray(byte b, int off, int len)(Code)
Writes array into this one and advance current position.
Parameters:
  b - intput buffer
Parameters:
  off - offset in the input buffer
Parameters:
  len - number of bytes in input buffer



_writeByte
final public void _writeByte(int b)(Code)
Writes byte and advance current position.
Parameters:
  b - byte to write



_writeDWord
final public void _writeDWord(int b)(Code)
Writes dword and advance current position.
Parameters:
  b - dword to write



_writeStringZ
final public byte[] _writeStringZ(String s)(Code)
Writes zero-ending string into the buffer and advance current position. (Flash5 back compatibility, uses Cp1252 encoding)
Parameters:
  s - string to write



_writeStringZ
final public byte[] _writeStringZ(String s, String encoding)(Code)
Writes zero-ending string into the buffer and advance current position.
Parameters:
  s - string to write the string converted to a byte array in Flash's favorite encoding



_writeWord
final public void _writeWord(int b)(Code)
Writes word and advance current position.
Parameters:
  b - word to write



ensureCapacity
final public void ensureCapacity(int cap)(Code)
Ensures that the buffer is as big as specified number of bytes
Parameters:
  cap - required size of buffer



flushBits
final public void flushBits()(Code)
Flushes bits buffer into flash buffer.

Has to be called after you finished writing series of bits
See Also:   FlashBuffer.writeBits
See Also:   FlashBuffer.initBits




getBits
final public int getBits(int n)(Code)
Reads unsigned bits from the buffer.

According to profiler this is probably the most time consuming operation. Below there is a new version, but I did not test it much, it's about 30% percent faster.
Parameters:
  n - number of bits to read read bits
See Also:   FlashBuffer.initBits
See Also:   FlashBuffer.getSBits




getBool
public boolean getBool()(Code)
Reads one bit and returns it as boolean true - if bit is 1, false - if bit is 0



getBuf
final public byte[] getBuf()(Code)
Returns the whole buffer. buffer



getByte
final public int getByte()(Code)
Reads one signed byte. signed byte



getByteAt
final public int getByteAt(int p)(Code)



getBytes
final public byte[] getBytes(int length)(Code)
Reads bytes into array of bytes.
Parameters:
  length - number of bytes to read created array of bytes with data



getCopy
public FlashBuffer getCopy()(Code)
Creates copy of the buffer. copy of the buffer



getDWord
public int getDWord()(Code)
Reads one signed dword. signed dword



getDWordAt
public int getDWordAt(int p)(Code)



getInputStream
public InputStream getInputStream()(Code)
Creates input stream which can be used to read data from this buffer. input stream
See Also:   FlashBuffer.getOutputStream



getInputStream
public InputStream getInputStream(int pos)(Code)
Creates input stream which can be used to read data from this buffer.
Parameters:
  pos - first input position, position to start reading from input stream
See Also:   FlashBuffer.getOutputStream



getMatrix
public AffineTransform getMatrix()(Code)



getOutputStream
public OutputStream getOutputStream()(Code)
Creates output stream which can be used to write data to this buffer. output stream
See Also:   FlashBuffer.getInputStream



getPos
final public int getPos()(Code)
Current read/write position. current read/write position



getRect
public Rectangle2D getRect()(Code)



getSBits
final public int getSBits(int n)(Code)
Reads signed bits from the buffer.


Parameters:
  n - number of bits to read read bits extended with sign
See Also:   FlashBuffer.initBits
See Also:   FlashBuffer.getBits




getSize
final public int getSize()(Code)
Returns size of the buffer. size of the buffer



getString
final public String getString()(Code)
Reads zero-ending string. read string



getString
final public String getString(int length)(Code)
Read string by its length.
Parameters:
  length - string length read string



getTo
final public void getTo(FlashBuffer fob, int length)(Code)
Reads bytes into given FlashBuffer.
Parameters:
  fob - flash buffer where to read bytes
Parameters:
  length - number of bytes to read



getUByte
final public int getUByte()(Code)
Reads one unsigned byte. unsigned byte



getUByteAt
final public int getUByteAt(int p)(Code)



getUDWord
public int getUDWord()(Code)
Reads one unsigned dword. unsigned dword



getUDWordAt
public int getUDWordAt(int p)(Code)



getUWord
final public int getUWord()(Code)
Reads one unsigned word. unsigned word



getUWordAt
final public int getUWordAt(int p)(Code)



getWord
final public int getWord()(Code)
Reads one signed word. signed word



getWordAt
final public int getWordAt(int p)(Code)



incPos
final public void incPos()(Code)
Increment current position.

Does not increase the buffer if new position is larger than current capacity.
See Also:   FlashBuffer.ensureCapacity
See Also:   FlashBuffer.setPos




init
public void init(byte[] buf, int pos, int size)(Code)



initBits
final public void initBits()(Code)
Inits bits buffer.

Has to be called before writing series of bits or before reading bits
See Also:   FlashBuffer.writeBits
See Also:   FlashBuffer.flushBits
See Also:   FlashBuffer.skipBits
See Also:   FlashBuffer.getBits




new_getBits
final public int new_getBits(int n)(Code)



setPos
final public void setPos(int pos)(Code)
Sets current read/write position.

Does not increase the buffer if new position is larger than current capacity.
Parameters:
  pos - new position
See Also:   FlashBuffer.ensureCapacity




setSize
final public void setSize(int size)(Code)
Sets new size of the buffer.

Does not increase the buffer if new position is larger than current capacity.
Parameters:
  size - new size of the buffer




skip
final public void skip(int inc)(Code)
Skips bytes (changes current position).

Does not increase the buffer if new position is larger than current capacity.
Parameters:
  inc - advance value




skipBits
final public void skipBits(int n)(Code)
Skips bits.
Parameters:
  n - number of bits to skip
See Also:   FlashBuffer.initBits



skipMatrix
public void skipMatrix()(Code)
Skips MATRIX tag without creating Matrix object



skipRect
public void skipRect()(Code)
Skips rectangle



toString
public String toString()(Code)



toString
public String toString(String encoding) throws java.io.UnsupportedEncodingException(Code)



write
final public void write(InputStream is) throws IOException(Code)
Writes specified inputstream to this buffer
Parameters:
  is - input stream



write
public void write(AffineTransform m)(Code)



write
public void write(Rectangle2D r)(Code)



writeArray
final public void writeArray(byte b, int off, int len)(Code)
Writes array into this one and advance current position.
Parameters:
  b - intput buffer
Parameters:
  off - offset in the input buffer
Parameters:
  len - number of bytes in input buffer



writeBit
final public void writeBit(int b)(Code)
Writes lower bit to bit buffer.
Parameters:
  b - bit to write
See Also:   FlashBuffer.initBits
See Also:   FlashBuffer.flushBits
See Also:   FlashBuffer.writeBits



writeBits
final public void writeBits(int v, int len)(Code)
Writes bits into the buffer.

Before starting writing bits you have to init or flush bits buffer using methods FlashBuffer.initBits or FlashBuffer.flushBits
Parameters:
  v - bits to write packed in integer
Parameters:
  len - number of bits to write
See Also:   FlashBuffer.initBits
See Also:   FlashBuffer.flushBits




writeBool
final public void writeBool(boolean b)(Code)
Writes boolean as a bit to bit buffer.
Parameters:
  b - boolean to write
See Also:   FlashBuffer.initBits
See Also:   FlashBuffer.flushBits



writeByte
final public void writeByte(int b)(Code)
Writes byte and advance current position.
Parameters:
  b - byte to write



writeByteAt
final public void writeByteAt(int b, int pos)(Code)
Writes byte at specified position.

Does not change current position.
Parameters:
  b - byte to write
Parameters:
  pos - position to write




writeDWord
final public void writeDWord(int b)(Code)
Writes dword and advance current position.
Parameters:
  b - dword to write



writeDWordAt
final public void writeDWordAt(int b, int pos)(Code)
Writes dword at specified position.

Does not change current position.
Parameters:
  b - dword to write
Parameters:
  pos - position to write




writeFOB
final public void writeFOB(FlashBuffer fob)(Code)
Writes FlashBuffer into this one and advance current position.
Parameters:
  fob - buffer to write



writeLongTag
final public void writeLongTag(int tagCode, int tagSize)(Code)
Writes long flash tag into the buffer and advance current position.


Parameters:
  tagCode - tag code
Parameters:
  tagSize - tag size
See Also:   Tag
See Also:   FlashBuffer.writeTag
See Also:   FlashBuffer.writeLongTagAt
See Also:   FlashBuffer.writeShortTagAt




writeLongTagAt
final public void writeLongTagAt(int tagCode, int tagSize, int pos)(Code)
Writes long flash tag into the buffer at specified position.

Does not advance position
Parameters:
  tagCode - tag code
Parameters:
  tagSize - tag size
See Also:   Tag
See Also:   FlashBuffer.writeLongTag
See Also:   FlashBuffer.writeShortTagAt
See Also:   FlashBuffer.writeTag




writeShortTagAt
final public void writeShortTagAt(int tagCode, int tagSize, int pos)(Code)
Writes short flash tag into the buffer at specified position.

Does not advance position
Parameters:
  tagCode - tag code
Parameters:
  tagSize - tag size
See Also:   Tag
See Also:   FlashBuffer.writeLongTag
See Also:   FlashBuffer.writeLongTagAt
See Also:   FlashBuffer.writeTag




writeStringL
final public void writeStringL(String s)(Code)
Writes length-prefixed string into the buffer and advance current position.
Parameters:
  s - string to write



writeStringL
final public void writeStringL(String s, String encoding)(Code)
Writes length-prefixed string into the buffer and advance current position.
Parameters:
  s - string to write
Parameters:
  encoding - charset encoding to use



writeStringZ
final public byte[] writeStringZ(String s)(Code)
Writes zero-ending string into the buffer and advance current position. +++ Back compatible with Jgen-1.4/Flash5 Uses default encoding of JGen 1.4, "Cp1252".
Parameters:
  s - string to write



writeStringZ
final public byte[] writeStringZ(String s, String encoding)(Code)
Writes zero-ending string into the buffer and advance current position.
Parameters:
  s - string to write
Parameters:
  encoding - charset encoding to use



writeTag
final public void writeTag(int tagCode, int tagSize)(Code)
Writes flash tag into the buffer and advance current position.

Depending on tag length writes short or long tag
Parameters:
  tagCode - tag code
Parameters:
  tagSize - tag size
See Also:   Tag
See Also:   FlashBuffer.writeLongTag
See Also:   FlashBuffer.writeLongTagAt
See Also:   FlashBuffer.writeShortTagAt




writeWord
final public void writeWord(int b)(Code)
Writes word and advance current position.
Parameters:
  b - word to write



writeWordAt
final public void writeWordAt(int b, int pos)(Code)
Writes word at specified position.

Does not change current position.
Parameters:
  b - word to write
Parameters:
  pos - position to write




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.