当前位置: 首页>>代码示例>>Java>>正文


Java DataOutputStream.writeByte方法代码示例

本文整理汇总了Java中java.io.DataOutputStream.writeByte方法的典型用法代码示例。如果您正苦于以下问题:Java DataOutputStream.writeByte方法的具体用法?Java DataOutputStream.writeByte怎么用?Java DataOutputStream.writeByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.io.DataOutputStream的用法示例。


在下文中一共展示了DataOutputStream.writeByte方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDataTypeShouldReturnUnknownIfPDXTypeIsNull

import java.io.DataOutputStream; //导入方法依赖的package包/类
@Test
public void getDataTypeShouldReturnUnknownIfPDXTypeIsNull() throws IOException {
  int somePdxTypeInt = 1;
  PdxType somePdxType = null;

  TypeRegistry mockTypeRegistry = mock(TypeRegistry.class);
  when(mockTypeRegistry.getType(somePdxTypeInt)).thenReturn(somePdxType);

  GemFireCacheImpl pdxInstance = mock(GemFireCacheImpl.class);
  when(pdxInstance.getPdxRegistry()).thenReturn(mockTypeRegistry);

  PowerMockito.mockStatic(GemFireCacheImpl.class);
  when(GemFireCacheImpl
      .getForPdx("PDX registry is unavailable because the Cache has been closed."))
          .thenReturn(pdxInstance);

  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  DataOutputStream out = new DataOutputStream(baos);
  out.writeByte(DSCODE.PDX);
  out.writeInt(somePdxTypeInt);
  byte[] bytes = baos.toByteArray();
  String type = DataType.getDataType(bytes);

  assertThat(type).isEqualTo("org.apache.geode.pdx.PdxInstance: unknown id=" + somePdxTypeInt);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:26,代码来源:DataTypeJUnitTest.java

示例2: doMessage

import java.io.DataOutputStream; //导入方法依赖的package包/类
private void doMessage ( Socket s, DataInputStream in, DataOutputStream out, Object payload ) throws Exception {
    System.err.println("Reading message...");

    int op = in.read();

    switch ( op ) {
    case TransportConstants.Call:
        // service incoming RMI call
        doCall(in, out, payload);
        break;

    case TransportConstants.Ping:
        // send ack for ping
        out.writeByte(TransportConstants.PingAck);
        break;

    case TransportConstants.DGCAck:
        UID u = UID.read(in);
        break;

    default:
        throw new IOException("unknown transport op " + op);
    }

    s.close();
}
 
开发者ID:hucheat,项目名称:APacheSynapseSimplePOC,代码行数:27,代码来源:JRMPListener.java

示例3: codeWrapArgument

import java.io.DataOutputStream; //导入方法依赖的package包/类
/**
 * Generate code for wrapping an argument of the given type
 * whose value can be found at the specified local variable
 * index, in order for it to be passed (as an Object) to the
 * invocation handler's "invoke" method.  The code is written
 * to the supplied stream.
 */
private void codeWrapArgument(Class<?> type, int slot,
                              DataOutputStream out)
    throws IOException
{
    if (type.isPrimitive()) {
        PrimitiveTypeInfo prim = PrimitiveTypeInfo.get(type);

        if (type == int.class ||
            type == boolean.class ||
            type == byte.class ||
            type == char.class ||
            type == short.class)
        {
            code_iload(slot, out);
        } else if (type == long.class) {
            code_lload(slot, out);
        } else if (type == float.class) {
            code_fload(slot, out);
        } else if (type == double.class) {
            code_dload(slot, out);
        } else {
            throw new AssertionError();
        }

        out.writeByte(opc_invokestatic);
        out.writeShort(cp.getMethodRef(
            prim.wrapperClassName,
            "valueOf", prim.wrapperValueOfDesc));

    } else {

        code_aload(slot, out);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:42,代码来源:ProxyGenerator.java

示例4: writeFlatKey

import java.io.DataOutputStream; //导入方法依赖的package包/类
/**
 * Writes the Cell's key part as it would have serialized in a KeyValue. The format is &lt;2 bytes
 * rk len&gt;&lt;rk&gt;&lt;1 byte cf len&gt;&lt;cf&gt;&lt;qualifier&gt;&lt;8 bytes
 * timestamp&gt;&lt;1 byte type&gt;
 * @param cell
 * @param out
 * @throws IOException
 */
public static void writeFlatKey(Cell cell, DataOutputStream out) throws IOException {
  short rowLen = cell.getRowLength();
  out.writeShort(rowLen);
  out.write(cell.getRowArray(), cell.getRowOffset(), rowLen);
  byte fLen = cell.getFamilyLength();
  out.writeByte(fLen);
  out.write(cell.getFamilyArray(), cell.getFamilyOffset(), fLen);
  out.write(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength());
  out.writeLong(cell.getTimestamp());
  out.writeByte(cell.getTypeByte());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:CellUtil.java

示例5: postSerialise

import java.io.DataOutputStream; //导入方法依赖的package包/类
protected void
postSerialise(
	DataOutputStream	os )

	throws IOException
{
	if ( protocol_version < DHTTransportUDP.PROTOCOL_VERSION_FIX_ORIGINATOR ){

			// originator version is at tail so it works with older versions

		os.writeByte( getTransport().getProtocolVersion());
	}
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:14,代码来源:DHTUDPPacketRequest.java

示例6: dump

import java.io.DataOutputStream; //导入方法依赖的package包/类
@Override
public void dump(final DataOutputStream dos) throws IOException
{
    super.dump(dos);
    dos.writeByte(parameter_annotation_table.length);

    for (final ParameterAnnotationEntry element : parameter_annotation_table) {
        element.dump(dos);
    }

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:ParameterAnnotations.java

示例7: codeUnwrapReturnValue

import java.io.DataOutputStream; //导入方法依赖的package包/类
/**
 * Generate code for unwrapping a return value of the given
 * type from the invocation handler's "invoke" method (as type
 * Object) to its correct type.  The code is written to the
 * supplied stream.
 */
private void codeUnwrapReturnValue(Class<?> type, DataOutputStream out)
    throws IOException
{
    if (type.isPrimitive()) {
        PrimitiveTypeInfo prim = PrimitiveTypeInfo.get(type);

        out.writeByte(opc_checkcast);
        out.writeShort(cp.getClass(prim.wrapperClassName));

        out.writeByte(opc_invokevirtual);
        out.writeShort(cp.getMethodRef(
            prim.wrapperClassName,
            prim.unwrapMethodName, prim.unwrapMethodDesc));

        if (type == int.class ||
            type == boolean.class ||
            type == byte.class ||
            type == char.class ||
            type == short.class)
        {
            out.writeByte(opc_ireturn);
        } else if (type == long.class) {
            out.writeByte(opc_lreturn);
        } else if (type == float.class) {
            out.writeByte(opc_freturn);
        } else if (type == double.class) {
            out.writeByte(opc_dreturn);
        } else {
            throw new AssertionError();
        }

    } else {

        out.writeByte(opc_checkcast);
        out.writeShort(cp.getClass(dotToSlash(type.getName())));

        out.writeByte(opc_areturn);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:46,代码来源:ProxyGenerator.java

示例8: send

import java.io.DataOutputStream; //导入方法依赖的package包/类
@Override
public void send(DataOutputStream out) throws IOException {
    byte[] packetId = VarData.getVarInt(0x23);
    byte[] levelType = VarData.packString(this.levelType.getId());
    VarData.writeVarInt(out, 12 + levelType.length + packetId.length);
    out.write(packetId);
    out.writeInt(entityID);
    out.writeByte(gamemode.getId());
    out.writeInt(dimensionType.getId());
    out.writeByte(difficulty.getId());
    out.writeByte(maxPlayers);
    out.write(levelType);
    out.writeBoolean(reducedDebug);
    out.flush();
}
 
开发者ID:Clout-Team,项目名称:JarCraftinator,代码行数:16,代码来源:PacketPlayOutJoinGame.java

示例9: save

import java.io.DataOutputStream; //导入方法依赖的package包/类
@Override
public void save(DataOutputStream out) throws Exception
{
    out.writeChar(letter);
    out.writeByte(isAcceptNode ? 1 : 0);
    out.writeInt(transitionSetBeginIndex);
    out.writeInt(transitionSetSize);
}
 
开发者ID:priester,项目名称:hanlpStudy,代码行数:9,代码来源:SimpleMDAGNode.java

示例10: dump

import java.io.DataOutputStream; //导入方法依赖的package包/类
/**
 * Dump instruction as byte code to stream out.
 * @param out Output stream
 */
@Override
public void dump( final DataOutputStream out ) throws IOException {
    out.writeByte(super.getOpcode());
    out.writeShort(super.getIndex());
    out.writeByte(nargs);
    out.writeByte(0);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:INVOKEINTERFACE.java

示例11: dump

import java.io.DataOutputStream; //导入方法依赖的package包/类
/**
 * Dump instruction as byte code to stream out.
 *
 * @param out Output stream
 */
@Override
public void dump(final DataOutputStream out) throws IOException {
    out.writeByte(super.getOpcode());
    for (int i = 0; i < padding; i++) {
        out.writeByte(0);
    }
    super.setIndex(getTargetOffset()); // Write default target offset
    out.writeInt(super.getIndex());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:Select.java

示例12: dump

import java.io.DataOutputStream; //导入方法依赖的package包/类
/**
 * Dump instruction as byte code to stream out.
 * @param out Output stream
 */
@Override
public void dump( final DataOutputStream out ) throws IOException {
    if (wide) {
        out.writeByte(com.sun.org.apache.bcel.internal.Const.WIDE);
    }
    out.writeByte(super.getOpcode());
    if (wide) {
        out.writeShort(index);
    } else {
        out.writeByte(index);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:RET.java

示例13: write

import java.io.DataOutputStream; //导入方法依赖的package包/类
/**
 * Write the constant to the output stream
 */
void write(Environment env, DataOutputStream out, ConstantPool tab) throws IOException {
    out.writeByte(CONSTANT_NAMEANDTYPE);
    out.writeShort(tab.index(name));
    out.writeShort(tab.index(type));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:NameAndTypeConstantData.java

示例14: write

import java.io.DataOutputStream; //导入方法依赖的package包/类
/**
 * Write the constant to the output stream
 */
void write(Environment env, DataOutputStream out, ConstantPool tab) throws IOException {
    out.writeByte(CONSTANT_CLASS);
    out.writeShort(tab.index(name));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:ClassConstantData.java

示例15: dump

import java.io.DataOutputStream; //导入方法依赖的package包/类
/**
 * Dump instruction as byte code to stream out.
 */
@Override
public void dump(final DataOutputStream out) throws IOException {
    super.dump(out);
    out.writeByte(b);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:BIPUSH.java


注:本文中的java.io.DataOutputStream.writeByte方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。