public class SWFWriter extends Object implements ISWFWriter
IOutputBitStream
. ZLIB compression is
optional. If enabled, compression is on-the-fly via a filtered output stream.Modifier and Type | Field and Description |
---|---|
static ISWFWriterFactory |
DEFAULT_SWF_WRITER_FACTORY
A factory for default SWF writers.
|
protected org.apache.flex.swf.io.IOutputBitStream |
outputBuffer |
protected org.apache.flex.swf.io.IOutputBitStream |
tagBuffer |
Constructor and Description |
---|
SWFWriter(ISWF swf,
Header.Compression useCompression)
Create a SWF writer.
|
SWFWriter(ISWF swf,
Header.Compression useCompression,
boolean enableDebug,
boolean enableTelemetry)
Create a SWF writer.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the internal output buffer that stores the encoded SWF tags and
part of the SWF header.
|
protected void |
finishTag(ITag tag,
org.apache.flex.swf.io.IOutputBitStream tagData,
org.apache.flex.swf.io.IOutputBitStream out)
Compute the tag length for the tag header, then write the header and the
buffered tag body to target output stream.
|
static double |
maxNum(double a,
double b,
double c,
double d)
Compares the absolute values of 4 signed doubles and returns the unsigned
magnitude of the number with the greatest absolute value.
|
static int |
maxNum(int a,
int b,
int c,
int d)
Compares the absolute values of 4 signed integers and returns the
unsigned magnitude of the number with the greatest absolute value.
|
static int |
requireFBCount(double value)
Calculate number of bits required to represent the given value in double
bit value.
|
static int |
requireSBCount(int... values) |
static int |
requireSBCount(int value)
Calculate number of bits required to represent the given value in signed
bit values.
|
static int |
requireUBCount(int value)
Calculate number of bits required to represent the given value in
unsigned bit values.
|
void |
writeARGB(ARGB argb) |
protected void |
writeCompressibleHeader() |
protected void |
writeDefineSprite(DefineSpriteTag tag) |
void |
writeDoABC(DoABCTag tag) |
void |
writeFileAttributes(FileAttributesTag tag) |
void |
writeRect(Rect rect) |
void |
writeRGB(RGB rgb) |
void |
writeRGBA(RGBA rgba) |
int |
writeTo(File outputFile)
Start writing to a file.
|
void |
writeTo(OutputStream output)
This method does not close the
output stream. |
public static final ISWFWriterFactory DEFAULT_SWF_WRITER_FACTORY
protected org.apache.flex.swf.io.IOutputBitStream tagBuffer
protected final org.apache.flex.swf.io.IOutputBitStream outputBuffer
public SWFWriter(ISWF swf, Header.Compression useCompression)
swf
- the SWF model to be encodeduseCompression
- use ZLIB compression if truepublic SWFWriter(ISWF swf, Header.Compression useCompression, boolean enableDebug, boolean enableTelemetry)
swf
- the SWF model to be encodeduseCompression
- use ZLIB compression if trueenableDebug
- enable debugging of the SWF if trueenableTelemetry
- enable telemetrypublic static int maxNum(int a, int b, int c, int d)
public static double maxNum(double a, double b, double c, double d)
public static int requireFBCount(double value)
value
- signed integerpublic static int requireSBCount(int value)
value
- signed integerpublic static int requireSBCount(int... values)
public static int requireUBCount(int value)
value
- signed integerprotected void finishTag(ITag tag, org.apache.flex.swf.io.IOutputBitStream tagData, org.apache.flex.swf.io.IOutputBitStream out)
tag
- tag objecttagData
- serialized tag bodyout
- target output streampublic void writeARGB(ARGB argb)
protected void writeCompressibleHeader()
public void writeDoABC(DoABCTag tag)
public void writeFileAttributes(FileAttributesTag tag)
public void writeRect(Rect rect)
public void writeRGB(RGB rgb)
public void writeRGBA(RGBA rgba)
protected void writeDefineSprite(DefineSpriteTag tag)
SWFReader.readDefineSprite()
public void writeTo(OutputStream output)
output
stream.writeTo
in interface ISWFWriter
output
- output streampublic int writeTo(File outputFile) throws FileNotFoundException, IOException
ISWFWriter
writeTo
in interface ISWFWriter
outputFile
- The output File
.FileNotFoundException
IOException
public void close() throws IOException
OutputStream
argument in writeTo(OutputStream)
.close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2016 The Apache Software Foundation. All rights reserved.