|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.alibaba.fastjson.serializer Class SerializeWriter
java.lang.Object java.io.Writer com.alibaba.fastjson.serializer.SerializeWriter
- All Implemented Interfaces:
- Closeable, Flushable, Appendable
public final class SerializeWriter
- extends Writer
- Author:
- wenshao
Constructor Summary | |
---|---|
SerializeWriter()
|
|
SerializeWriter(int initialSize)
Creates a new CharArrayWriter with the specified initial size. |
|
SerializeWriter(SerializerFeature... features)
Creates a new CharArrayWriter. |
Method Summary | |
---|---|
SerializeWriter |
append(char c)
Appends the specified character to this writer. |
SerializeWriter |
append(CharSequence csq)
|
SerializeWriter |
append(CharSequence csq,
int start,
int end)
|
void |
close()
Close the stream. |
void |
config(SerializerFeature feature,
boolean state)
|
void |
expandCapacity(int minimumCapacity)
|
void |
flush()
Flush the stream. |
boolean |
isEnabled(SerializerFeature feature)
|
void |
reset()
Resets the buffer so that you can use it again without throwing away the already allocated buffer. |
int |
size()
Returns the current size of the buffer. |
byte[] |
toBytes(String charsetName)
|
char[] |
toCharArray()
Returns a copy of the input data. |
String |
toString()
Converts input data to a string. |
void |
write(char c)
|
void |
write(char[] c,
int off,
int len)
Writes characters to the buffer. |
void |
write(int c)
Writes a character to the buffer. |
void |
write(String text)
|
void |
write(String str,
int off,
int len)
Write a portion of a string to the buffer. |
void |
writeBooleanArray(boolean[] array)
|
void |
writeByteArray(byte[] bytes)
|
void |
writeFieldEmptyList(char seperator,
String key)
|
void |
writeFieldName(String key)
|
void |
writeFieldName(String key,
boolean checkSpecial)
|
void |
writeFieldNull(char seperator,
String name)
|
void |
writeFieldNullBoolean(char seperator,
String name)
|
void |
writeFieldNullList(char seperator,
String name)
|
void |
writeFieldNullNumber(char seperator,
String name)
|
void |
writeFieldNullString(char seperator,
String name)
|
void |
writeFieldValue(char seperator,
String name,
BigDecimal value)
|
void |
writeFieldValue(char seperator,
String name,
boolean value)
|
void |
writeFieldValue(char seperator,
String name,
char value)
|
void |
writeFieldValue(char seperator,
String name,
double value)
|
void |
writeFieldValue(char seperator,
String name,
Enum<?> value)
|
void |
writeFieldValue(char seperator,
String name,
float value)
|
void |
writeFieldValue(char seperator,
String name,
int value)
|
void |
writeFieldValue(char seperator,
String name,
long value)
|
void |
writeFieldValue(char seperator,
String name,
String value)
|
void |
writeFieldValue1(char seperator,
String name,
boolean value)
|
void |
writeFieldValue1(char seperator,
String name,
int value)
|
void |
writeFieldValue1(char seperator,
String name,
long value)
|
void |
writeInt(int i)
|
void |
writeIntAndChar(int i,
char c)
|
void |
writeIntArray(int[] array)
|
void |
writeKeyWithDoubleQuote(String text)
|
void |
writeKeyWithDoubleQuote(String text,
boolean checkSpecial)
|
void |
writeLong(long i)
|
void |
writeLongAndChar(long i,
char c)
|
void |
writeLongArray(long[] array)
|
void |
writeNull()
|
void |
writeShortArray(short[] array)
|
void |
writeString(String text)
|
void |
writeString(String text,
char seperator)
|
void |
writeTo(OutputStream out,
Charset charset)
|
void |
writeTo(OutputStream out,
String charset)
|
void |
writeTo(Writer out)
Writes the contents of the buffer to another character stream. |
Methods inherited from class java.io.Writer |
---|
write |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
SerializeWriter
public SerializeWriter()
SerializeWriter
public SerializeWriter(SerializerFeature... features)
- Creates a new CharArrayWriter.
SerializeWriter
public SerializeWriter(int initialSize)
- Creates a new CharArrayWriter with the specified initial size.
- Parameters:
initialSize
- an int specifying the initial buffer size.- Throws:
IllegalArgumentException
- if initialSize is negative
Method Detail |
---|
config
public void config(SerializerFeature feature, boolean state)
isEnabled
public boolean isEnabled(SerializerFeature feature)
write
public void write(int c)
write
public void write(char c)
write
public void write(char[] c, int off, int len)
- Writes characters to the buffer.
- Parameters:
c
- the data to be writtenoff
- the start offset in the datalen
- the number of chars that are written
expandCapacity
public void expandCapacity(int minimumCapacity)
write
public void write(String str, int off, int len)
- Write a portion of a string to the buffer.
- Parameters:
str
- String to be written fromoff
- Offset from which to start reading characterslen
- Number of characters to be written
writeTo
public void writeTo(Writer out) throws IOException
- Writes the contents of the buffer to another character stream.
- Parameters:
out
- the output stream to write to- Throws:
IOException
- If an I/O error occurs.
writeTo
public void writeTo(OutputStream out, String charset) throws IOException
- Throws:
IOException
writeTo
public void writeTo(OutputStream out, Charset charset) throws IOException
- Throws:
IOException
append
public SerializeWriter append(CharSequence csq)
- Specified by:
append
in interfaceAppendable
- Overrides:
append
in classWriter
append
public SerializeWriter append(CharSequence csq, int start, int end)
- Specified by:
append
in interfaceAppendable
- Overrides:
append
in classWriter
append
public SerializeWriter append(char c)
- Appends the specified character to this writer.
An invocation of this method of the form out.append(c) behaves in exactly the same way as the invocation
out.write(c)
- Specified by:
append
in interfaceAppendable
- Overrides:
append
in classWriter
- Parameters:
c
- The 16-bit character to append- Returns:
- This writer
- Since:
- 1.5
reset
public void reset()
- Resets the buffer so that you can use it again without throwing away the already allocated buffer.
toCharArray
public char[] toCharArray()
- Returns a copy of the input data.
- Returns:
- an array of chars copied from the input data.
toBytes
public byte[] toBytes(String charsetName)
size
public int size()
- Returns the current size of the buffer.
- Returns:
- an int representing the current size of the buffer.
toString
public String toString()
flush
public void flush()
close
public void close()
- Close the stream. This method does not release the buffer, since its contents might still be required. Note:
Invoking this method in this class will have no effect.
writeBooleanArray
public void writeBooleanArray(boolean[] array) throws IOException
- Throws:
IOException
write
public void write(String text)
writeInt
public void writeInt(int i)
writeShortArray
public void writeShortArray(short[] array) throws IOException
- Throws:
IOException
writeByteArray
public void writeByteArray(byte[] bytes)
writeIntArray
public void writeIntArray(int[] array)
writeIntAndChar
public void writeIntAndChar(int i, char c)
writeLongAndChar
public void writeLongAndChar(long i, char c) throws IOException
- Throws:
IOException
writeLong
public void writeLong(long i)
writeNull
public void writeNull()
writeLongArray
public void writeLongArray(long[] array)
writeKeyWithDoubleQuote
public void writeKeyWithDoubleQuote(String text)
writeKeyWithDoubleQuote
public void writeKeyWithDoubleQuote(String text, boolean checkSpecial)
writeFieldNull
public void writeFieldNull(char seperator, String name)
writeFieldEmptyList
public void writeFieldEmptyList(char seperator, String key)
writeFieldNullString
public void writeFieldNullString(char seperator, String name)
writeFieldNullBoolean
public void writeFieldNullBoolean(char seperator, String name)
writeFieldNullList
public void writeFieldNullList(char seperator, String name)
writeFieldNullNumber
public void writeFieldNullNumber(char seperator, String name)
writeFieldValue
public void writeFieldValue(char seperator, String name, char value)
writeFieldValue
public void writeFieldValue(char seperator, String name, boolean value)
writeFieldValue1
public void writeFieldValue1(char seperator, String name, boolean value)
writeFieldValue
public void writeFieldValue(char seperator, String name, int value)
writeFieldValue1
public void writeFieldValue1(char seperator, String name, int value)
writeFieldValue
public void writeFieldValue(char seperator, String name, long value)
writeFieldValue1
public void writeFieldValue1(char seperator, String name, long value)
writeFieldValue
public void writeFieldValue(char seperator, String name, float value)
writeFieldValue
public void writeFieldValue(char seperator, String name, double value)
writeFieldValue
public void writeFieldValue(char seperator, String name, String value)
writeFieldValue
public void writeFieldValue(char seperator, String name, Enum<?> value)
writeFieldValue
public void writeFieldValue(char seperator, String name, BigDecimal value)
writeString
public void writeString(String text, char seperator)
writeString
public void writeString(String text)
writeFieldName
public void writeFieldName(String key)
writeFieldName
public void writeFieldName(String key, boolean checkSpecial)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2012 Alibaba Group. All Rights Reserved.