protected void writeAMF3ByteArray(byte[] bytes) throws IOException { ensureCapacity(1); buffer[position++] = AMF3_BYTEARRAY; int index = storedObjects.putIfAbsent(bytes); if (index >= 0) writeAMF3UnsignedIntegerData(index << 1); else { writeAMF3UnsignedIntegerData(bytes.length << 1 | 0x01); flushBuffer(); out.write(bytes, 0, bytes.length); } }
protected void writeAMF3ByteArray(byte[] bytes) throws IOException { ensureCapacity(1); buffer[position++] = AMF3_BYTEARRAY; int index = storedObjects.putIfAbsent(bytes); if (index >= 0) writeAMF3UnsignedIntegerData(index << 1); else { writeAMF3UnsignedIntegerData(bytes.length << 1 | 0x01); flushBuffer(); out.write(bytes, 0, bytes.length); } }
protected void writeAMF3ByteArray(byte[] bytes) throws IOException { ensureCapacity(1); buffer[position++] = AMF3_BYTEARRAY; int index = storedObjects.putIfAbsent(bytes); if (index >= 0) writeAMF3UnsignedIntegerData(index << 1); else { writeAMF3UnsignedIntegerData(bytes.length << 1 | 0x01); flushBuffer(); out.write(bytes, 0, bytes.length); } }
protected void writeAMF3Date(Date date) throws IOException { ensureCapacity(1); buffer[position++] = AMF3_DATE; int index = storedObjects.putIfAbsent(date); if (index >= 0) writeAMF3UnsignedIntegerData(index << 1); else { writeAMF3UnsignedIntegerData(0x01); ensureCapacity(8); position = writeLongData(buffer, position, Double.doubleToRawLongBits(date.getTime())); } }
protected void writeAMF3Date(Date date) throws IOException { ensureCapacity(1); buffer[position++] = AMF3_DATE; int index = storedObjects.putIfAbsent(date); if (index >= 0) writeAMF3UnsignedIntegerData(index << 1); else { writeAMF3UnsignedIntegerData(0x01); ensureCapacity(8); position = writeLongData(buffer, position, Double.doubleToRawLongBits(date.getTime())); } }
protected void writeAMF3Date(Date date) throws IOException { ensureCapacity(1); buffer[position++] = AMF3_DATE; int index = storedObjects.putIfAbsent(date); if (index >= 0) writeAMF3UnsignedIntegerData(index << 1); else { writeAMF3UnsignedIntegerData(0x01); ensureCapacity(8); position = writeLongData(buffer, position, Double.doubleToRawLongBits(date.getTime())); } }
protected void writeAMF3Xml(Document doc) throws IOException { ensureCapacity(1); buffer[position++] = (legacyXmlSerialization ? AMF3_XML : AMF3_XMLSTRING); int index = storedObjects.putIfAbsent(doc); if (index >= 0) writeAMF3UnsignedIntegerData(index << 1); else { byte[] bytes = xmlUtil.toString(doc).getBytes("UTF-8"); writeAMF3UnsignedIntegerData((bytes.length << 1) | 0x01); flushBuffer(); out.write(bytes, 0, bytes.length); } }
protected void writeAMF3Xml(Document doc) throws IOException { ensureCapacity(1); buffer[position++] = (legacyXmlSerialization ? AMF3_XML : AMF3_XMLSTRING); int index = storedObjects.putIfAbsent(doc); if (index >= 0) writeAMF3UnsignedIntegerData(index << 1); else { byte[] bytes = xmlUtil.toString(doc).getBytes("UTF-8"); writeAMF3UnsignedIntegerData((bytes.length << 1) | 0x01); flushBuffer(); out.write(bytes, 0, bytes.length); } }
protected void writeAMF3Xml(Document doc) throws IOException { ensureCapacity(1); buffer[position++] = (legacyXmlSerialization ? AMF3_XML : AMF3_XMLSTRING); int index = storedObjects.putIfAbsent(doc); if (index >= 0) writeAMF3UnsignedIntegerData(index << 1); else { byte[] bytes = xmlUtil.toString(doc).getBytes("UTF-8"); writeAMF3UnsignedIntegerData((bytes.length << 1) | 0x01); flushBuffer(); out.write(bytes, 0, bytes.length); } }
protected void writeAMF3ObjectArray(Object array) throws IOException { ensureCapacity(1); buffer[position++] = AMF3_ARRAY; int index = storedObjects.putIfAbsent(array); if (index >= 0) writeAMF3UnsignedIntegerData(index << 1); else { int length = Array.getLength(array); writeAMF3UnsignedIntegerData(length << 1 | 0x01); ensureCapacity(1); buffer[position++] = 0x01; for (int i = 0; i < length; i++) writeObject(Array.get(array, i)); } }
protected void writeAMF3Integer(int i) throws IOException { if (i < AMF3_INTEGER_MIN || i > AMF3_INTEGER_MAX) writeAMF3Number(i); else { ensureCapacity(1); buffer[position++] = AMF3_INTEGER; writeAMF3UnsignedIntegerData(i & AMF3_SIGNED_INTEGER_MASK); } }
protected void writeAMF3Integer(int i) throws IOException { if (i < AMF3_INTEGER_MIN || i > AMF3_INTEGER_MAX) writeAMF3Number(i); else { ensureCapacity(1); buffer[position++] = AMF3_INTEGER; writeAMF3UnsignedIntegerData(i & AMF3_SIGNED_INTEGER_MASK); } }
protected void writeAMF3Integer(int i) throws IOException { if (i < AMF3_INTEGER_MIN || i > AMF3_INTEGER_MAX) writeAMF3Number(i); else { ensureCapacity(1); buffer[position++] = AMF3_INTEGER; writeAMF3UnsignedIntegerData(i & AMF3_SIGNED_INTEGER_MASK); } }
protected void writeAMF3DoubleArray(double[] array) throws IOException { ensureCapacity(1); buffer[position++] = AMF3_ARRAY; int index = storedObjects.putIfAbsent(array); if (index >= 0) writeAMF3UnsignedIntegerData(index << 1); else { writeAMF3UnsignedIntegerData(array.length << 1 | 0x01); ensureCapacity(1); buffer[position++] = 0x01; for (double i : array) writeAMF3Number(i); } }
protected void writeAMF3ShortArray(short[] array) throws IOException { ensureCapacity(1); buffer[position++] = AMF3_ARRAY; int index = storedObjects.putIfAbsent(array); if (index >= 0) writeAMF3UnsignedIntegerData(index << 1); else { writeAMF3UnsignedIntegerData(array.length << 1 | 0x01); ensureCapacity(1); buffer[position++] = 0x01; for (short i : array) writeAMF3Integer(i); } }
protected void writeAMF3DoubleArray(double[] array) throws IOException { ensureCapacity(1); buffer[position++] = AMF3_ARRAY; int index = storedObjects.putIfAbsent(array); if (index >= 0) writeAMF3UnsignedIntegerData(index << 1); else { writeAMF3UnsignedIntegerData(array.length << 1 | 0x01); ensureCapacity(1); buffer[position++] = 0x01; for (double i : array) writeAMF3Number(i); } }
protected void writeAMF3ShortArray(short[] array) throws IOException { ensureCapacity(1); buffer[position++] = AMF3_ARRAY; int index = storedObjects.putIfAbsent(array); if (index >= 0) writeAMF3UnsignedIntegerData(index << 1); else { writeAMF3UnsignedIntegerData(array.length << 1 | 0x01); ensureCapacity(1); buffer[position++] = 0x01; for (short i : array) writeAMF3Integer(i); } }
protected void writeAMF3FloatArray(float[] array) throws IOException { ensureCapacity(1); buffer[position++] = AMF3_ARRAY; int index = storedObjects.putIfAbsent(array); if (index >= 0) writeAMF3UnsignedIntegerData(index << 1); else { writeAMF3UnsignedIntegerData(array.length << 1 | 0x01); ensureCapacity(1); buffer[position++] = 0x01; for (float i : array) writeAMF3Number(i); } }
protected void writeAMF3DoubleArray(double[] array) throws IOException { ensureCapacity(1); buffer[position++] = AMF3_ARRAY; int index = storedObjects.putIfAbsent(array); if (index >= 0) writeAMF3UnsignedIntegerData(index << 1); else { writeAMF3UnsignedIntegerData(array.length << 1 | 0x01); ensureCapacity(1); buffer[position++] = 0x01; for (double i : array) writeAMF3Number(i); } }
protected void writeAMF3FloatArray(float[] array) throws IOException { ensureCapacity(1); buffer[position++] = AMF3_ARRAY; int index = storedObjects.putIfAbsent(array); if (index >= 0) writeAMF3UnsignedIntegerData(index << 1); else { writeAMF3UnsignedIntegerData(array.length << 1 | 0x01); ensureCapacity(1); buffer[position++] = 0x01; for (float i : array) writeAMF3Number(i); } }