Package com.itextpdf.io.source
Class OutputStreamOutputStream>
java.lang.Object
java.io.OutputStream
com.itextpdf.io.source.OutputStream
- All Implemented Interfaces:
-
Closeable
,Flushable
,AutoCloseable
- Direct Known Subclasses:
-
PdfOutputStream
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
Do not use this constructor.OutputStream
(OutputStream outputStream) Creates a newOutputStream
instance based onOutputStream
instance.OutputStream
(OutputStream outputStream, boolean localHighPrecision) Creates a newOutputStream
instance based onOutputStream
instance and precision setting value. -
Method Summary
Modifier and TypeMethodDescriptionvoid
assignBytes
(byte[] bytes, int count) void
close()
void
flush()
long
Gets current output stream position.static boolean
Gets global high precision setting.boolean
Gets local high precision setting.Gets internalOutputStream
.boolean
Returns true, if internalOutputStream
have to be closed afterclose()
call, false otherwise.void
reset()
void
setCloseStream
(boolean closeStream) Sets internalOutputStream
to be closed afterclose()
.static void
setHighPrecision
(boolean value) Sets global high precision setting for allOutputStream
instances.void
setLocalHighPrecision
(boolean value) Sets local high precision setting for theOutputStream
.void
write
(byte[] b) void
write
(byte[] b, int off, int len) void
write
(int b) void
writeByte
(byte value) writeByte
(int value) Writes byte to internalOutputStream
.writeBytes
(byte[] b) Seewrite(byte[])
.writeBytes
(byte[] b, int off, int len) writeDouble
(double value) Writes double to internalOutputStream
in ISO format.writeDouble
(double value, boolean highPrecision) Writes double to internalOutputStream
in ISO format.writeFloat
(float value) Writes float to internalOutputStream
in ISO format.writeFloat
(float value, boolean highPrecision) Writes float to internalOutputStream
in ISO format.writeFloats
(float[] value) Writes float array to internalOutputStream
in ISO format.writeInteger
(int value) Writes int to internalOutputStream
in ISO format.writeLong
(long value) Writes long to internalOutputStream
in ISO format.Writes new line to internalOutputStream
.Writes space to internalOutputStream
.writeString
(String value) WritesString
to internalOutputStream
in ISO format.Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
outputStream
-
currentPos
protected long currentPos -
closeStream
protected boolean closeStream
-
-
Constructor Details
-
OutputStream
Creates a newOutputStream
instance based onOutputStream
instance.- Parameters:
-
outputStream
- theOutputStream
instance.
-
OutputStream
protected OutputStream()Do not use this constructor. This is only for internal usage. -
OutputStream
Creates a newOutputStream
instance based onOutputStream
instance and precision setting value.- Parameters:
-
outputStream
- theOutputStream
instance. -
localHighPrecision
- If true, all float and double values will be written with high precision. GlobalByteUtils.HighPrecision
setting will be overridden by this one.
-
-
Method Details
-
getHighPrecision
public static boolean getHighPrecision()Gets global high precision setting.- Returns:
- global high precision setting.
-
setHighPrecision
public static void setHighPrecision(boolean value) Sets global high precision setting for allOutputStream
instances.- Parameters:
-
value
- if true, all floats and double will be written with high precision in allOutputStream
instances.
-
getLocalHighPrecision
public boolean getLocalHighPrecision()Gets local high precision setting.- Returns:
- local high precision setting.
-
setLocalHighPrecision
public void setLocalHighPrecision(boolean value) Sets local high precision setting for theOutputStream
. GlobalByteUtils.HighPrecision
setting will be overridden by this one.- Parameters:
-
value
- if true, all floats and double will be written with high precision in the underlyingOutputStream
.
-
write
- Specified by:
-
write
in classOutputStream
- Throws:
-
IOException
-
write
- Overrides:
-
write
in classOutputStream
- Throws:
-
IOException
-
write
- Overrides:
-
write
in classOutputStream
- Throws:
-
IOException
-
writeByte
public void writeByte(byte value) - Parameters:
-
value
- byte to write. - Throws:
-
IOException
- ifIOException
occurs.
-
flush
- Specified by:
-
flush
in interfaceFlushable
- Overrides:
-
flush
in classOutputStream
- Throws:
-
IOException
-
close
- Specified by:
-
close
in interfaceAutoCloseable
- Specified by:
-
close
in interfaceCloseable
- Overrides:
-
close
in classOutputStream
- Throws:
-
IOException
-
writeLong
Writes long to internalOutputStream
in ISO format.- Parameters:
-
value
- value to write. - Returns:
- this stream as passed generic stream.
-
writeInteger
Writes int to internalOutputStream
in ISO format.- Parameters:
-
value
- value to write. - Returns:
- this stream as passed generic stream.
-
writeFloat
Writes float to internalOutputStream
in ISO format.- Parameters:
-
value
- value to write. - Returns:
- this stream as passed generic stream.
-
writeFloat
Writes float to internalOutputStream
in ISO format.- Parameters:
-
value
- value to write. -
highPrecision
- If true, float value will be written with high precision. - Returns:
- this stream as passed generic stream.
-
writeFloats
Writes float array to internalOutputStream
in ISO format.- Parameters:
-
value
- float array to write. - Returns:
- this stream as passed generic stream.
-
writeDouble
Writes double to internalOutputStream
in ISO format.- Parameters:
-
value
- value to write. - Returns:
- this stream as passed generic stream.
-
writeDouble
Writes double to internalOutputStream
in ISO format.- Parameters:
-
value
- value to write. -
highPrecision
- If true, double value will be written with high precision. - Returns:
- this stream as passed generic stream.
-
writeByte
Writes byte to internalOutputStream
.- Parameters:
-
value
- value to write. - Returns:
- this stream as passed generic stream.
-
writeSpace
Writes space to internalOutputStream
.- Returns:
- this stream as passed generic stream.
-
writeNewLine
Writes new line to internalOutputStream
.- Returns:
- this stream as passed generic stream.
-
writeString
WritesString
to internalOutputStream
in ISO format.- Parameters:
-
value
- string to write. - Returns:
- this stream as passed generic stream.
-
writeBytes
Seewrite(byte[])
.- Parameters:
-
b
- byte array to write. - Returns:
- this stream as passed generic stream.
- Throws:
-
IOException
- ifIOException
is thrown.
-
writeBytes
- Parameters:
-
b
- the data to write. -
off
- the start offset in the data. -
len
- the number of bytes to write. - Returns:
- this stream as passed generic stream.
- Throws:
-
IOException
- ifIOException
is thrown.
-
getCurrentPos
public long getCurrentPos()Gets current output stream position.- Returns:
- current output stream position.
-
getOutputStream
Gets internalOutputStream
.- Returns:
-
internal
OutputStream
.
-
isCloseStream
public boolean isCloseStream()Returns true, if internalOutputStream
have to be closed afterclose()
call, false otherwise.- Returns:
- true if stream needs to be closed, false if it's done manually.
-
setCloseStream
public void setCloseStream(boolean closeStream) Sets internalOutputStream
to be closed afterclose()
.- Parameters:
-
closeStream
- true if stream needs to be closed, false if it's done manually.
-
assignBytes
public void assignBytes(byte[] bytes, int count) - Parameters:
-
bytes
- bytes to assign. -
count
- number of bytes to assign.
-
reset
public void reset()- Throws:
-
IOException
- if internalOutputStream
. is not aByteArrayOutputStream
instance.
-