本文整理汇总了Java中com.alibaba.dubbo.common.model.media.MediaContent类的典型用法代码示例。如果您正苦于以下问题:Java MediaContent类的具体用法?Java MediaContent怎么用?Java MediaContent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MediaContent类属于com.alibaba.dubbo.common.model.media包,在下文中一共展示了MediaContent类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test_MultiObject_WithType
import com.alibaba.dubbo.common.model.media.MediaContent; //导入依赖的package包/类
@Test
public void test_MultiObject_WithType() throws Exception {
ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
objectOutput.writeBool(false);
objectOutput.writeObject(bigPerson);
objectOutput.writeByte((byte) 23);
objectOutput.writeObject(mediaContent);
objectOutput.writeInt(-23);
objectOutput.flushBuffer();
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
byteArrayOutputStream.toByteArray());
ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
assertEquals(false, deserialize.readBool());
assertEquals(bigPerson, deserialize.readObject(BigPerson.class));
assertEquals((byte) 23, deserialize.readByte());
assertEquals(mediaContent, deserialize.readObject(MediaContent.class));
assertEquals(-23, deserialize.readInt());
try {
deserialize.readObject();
fail();
} catch (IOException expected) {
}
}
示例2: test_MediaContent_WithType_badStream
import com.alibaba.dubbo.common.model.media.MediaContent; //导入依赖的package包/类
@Test
public void test_MediaContent_WithType_badStream() throws Exception {
ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
objectOutput.writeObject(mediaContent);
objectOutput.flushBuffer();
byte[] byteArray = byteArrayOutputStream.toByteArray();
for (int i = 0; i < byteArray.length; i++) {
if(i%3 == 0) {
byteArray[i] = (byte)~byteArray[i];
}
}
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArray);
try {
ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
@SuppressWarnings("unused") // local variable, convenient for debug
Object read = deserialize.readObject(MediaContent.class);
fail();
} catch (IOException expected) {
System.out.println(expected);
}
}
示例3: test_MediaContent_WithType_badStream
import com.alibaba.dubbo.common.model.media.MediaContent; //导入依赖的package包/类
@Test
public void test_MediaContent_WithType_badStream() throws Exception {
ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
objectOutput.writeObject(mediaContent);
objectOutput.flushBuffer();
byte[] byteArray = byteArrayOutputStream.toByteArray();
for (int i = 0; i < byteArray.length; i++) {
if(i%3 == 0) {
byteArray[i] = (byte)~byteArray[i];
}
}
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArray);
try {
ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
@SuppressWarnings("unused") // local variable, convenient for debug
Object read = deserialize.readObject(MediaContent.class);
fail();
} catch (JSONException expected) {
System.out.println(expected);
}
}