SerializeWriter (fastjson 1.1.26 API)

fastjson



com.alibaba.fastjson.serializer Class SerializeWriter

java.lang.Object
  extended by java.io.Writer
      extended by com.alibaba.fastjson.serializer.SerializeWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable

public final class SerializeWriter
extends Writer

Author:
wenshao

Constructor Summary
 
Method Summary
 SerializeWriter
 SerializeWriter
 SerializeWriter
 void
 void
 void
 void
 boolean
 void
 int
 byte[]
 char[]
 String
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 void
 
Methods inherited from class java.io.Writer
 
Methods inherited from class java.lang.Object
 

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)
Writes a character to the buffer.

Overrides:
write in class Writer

write

public void write(char c)

write

public void write(char[] c,
                  int off,
                  int len)
Writes characters to the buffer.

Specified by:
write in class Writer
Parameters:
c - the data to be written
off - the start offset in the data
len - 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.

Overrides:
write in class Writer
Parameters:
str - String to be written from
off - Offset from which to start reading characters
len - 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 interface Appendable
Overrides:
append in class Writer

append

public SerializeWriter append(CharSequence csq,
                              int start,
                              int end)
Specified by:
append in interface Appendable
Overrides:
append in class Writer

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 interface Appendable
Overrides:
append in class Writer
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()
Converts input data to a string.

Overrides:
toString in class Object
Returns:
the string.

flush

public void flush()
Flush the stream.

Specified by:
flush in interface Flushable
Specified by:
flush in class Writer

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.

Specified by:
close in interface Closeable
Specified by:
close in class Writer

writeBooleanArray

public void writeBooleanArray(boolean[] array)
                       throws IOException
Throws:
IOException

write

public void write(String text)
Overrides:
write in class Writer

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)


Copyright © 2012 Alibaba Group. All Rights Reserved.