本文整理汇总了C++中DataInputStream类的典型用法代码示例。如果您正苦于以下问题:C++ DataInputStream类的具体用法?C++ DataInputStream怎么用?C++ DataInputStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DataInputStream类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
int network_information_table_section::subtable::read(DataInputStream& istream ) { // throws IOException
int retVal = 0;
// read firstIndex
{
firstIndex=(istream.readUI8());
retVal+=1;
}
// read numberOfRecords
{
numberOfRecords=(istream.readUI8());
retVal+=1;
}
// read bf3
bf3= istream.readUI8();
retVal += 1;
// read records
for (int iIdx=0; iIdx <(numberOfRecords + (0)); iIdx++) {
org_himalay_si_network_information_table_section_subtable_Record__PTR_TYPE temp;
org_himalay_si_network_information_table_section_subtable_Record__NEW( temp);
temp->parent=this;
retVal += temp->read(istream);
records.add(temp);
}
// read descriptor
if ( (parent->tableHeader->getSection_length() - (retVal- 2) -4) > 0 ) {
org_himalay_si_Descriptors__NEW( descriptor);
retVal += descriptor->read(istream);
}
return retVal;
}
示例2: read
int OpenSessionResponse::read(DataInputStream& istream ) { // throws IOException
int retVal = 0;
// read length
{
length=(istream.readUI8());
retVal+=1;
}
// read resourceIdentifier
{
resourceIdentifier=istream.readUI32() ;
retVal+=4;
}
// read sessionStatus
{
sessionStatus=(istream.readUI8());
retVal+=1;
}
// read sessionNb
{
sessionNb=istream.readUI16();
retVal+=2;
}
return retVal;
}
示例3: readNoHeader
int DSG_packetError::readNoHeader(DataInputStream& istream ) { // throws IOException
int retVal = 0;
// length
{
length=(istream.readUI8());
retVal+=1;
}
// transaction_id
{
transaction_id=(istream.readUI8());
retVal+=1;
}
return retVal;
}
示例4: istream
int dvbJapp_locator_descriptor::read(DataInputStream& distream ) { // throws IOException
int retVal = 0;
int sizeLimit= desc_header->length + (0);
ui8* ba = new ui8[sizeLimit];
distream.readFully(ba, 0, sizeLimit);
ByteArrayDataInputStream istream(ba, 0, sizeLimit);
{
// read desc_header
retVal += desc_header->read(istream);
// read base_directory
{
retVal+=base_directory->read(istream);
}
// read class_path
{
retVal+=class_path->read(istream);
}
// read initial_class
{
retVal+=initial_class->read(istream);
}
}
return retVal;
}
示例5: read_socket
void Engine::read_socket(DataInputStream & network_in)
{
if( BIO_pending(bioIn) > 64*1024 ) // Enough for 4 ssl packets
return;
Data data;
if( network_in.read(data) == 0 )
return;
wLog("sock.read: %d", data.getSize());
int len = BIO_write(bioIn, data.getData(), data.getSize()); // Consumes everything by docs
wLog("BIO_write: %d", len);
}
示例6: ByteArrayDataInputStream
int network_information_table_section::readNoHeader(DataInputStream& istream ) { // throws IOException
int retVal = 0;
// bf2
bf2= istream.readUI8();
retVal += 1;
// subtableInstance
{
ui8* ba= new ui8[tableHeader->getSection_length()+(-5)];
int iCount = istream.read(ba,tableHeader->getSection_length()+(-5));
ByteArrayDataInputStream* bais= new ByteArrayDataInputStream(ba,0,iCount );
retVal += subtableInstance->read(*bais);
delete bais;
}
// CRC
{
CRC=istream.readUI32() ;
retVal+=4;
}
return retVal;
}
示例7: File
void SaveHandler::func_22150_b()
{
try
{
File file = new File(saveDirectory, "session.lock");
DataInputStream datainputstream = new DataInputStream(new FileInputStream(file));
try
{
if(datainputstream.readLong() != now)
{
throw new MinecraftException("The save is being accessed from another location, aborting");
}
}
ly
{
datainputstream.close();
}
}
catch(IOException ioexception)
{
throw new MinecraftException("Failed to check session lock, aborting");
}
}
示例8: main
int main (int argc, char **argv) {
if(isatty(STDIN_FILENO) && argc==1) {
cout<<"No input data or parameters. Use -h,--help for more information"<<endl;
exit(EXIT_FAILURE);
}
gengetopt_args_info args_info;
TRY_EXCEPTION();
if (cmdline_parser (argc, argv, &args_info) != 0)
exit(EXIT_FAILURE);
#ifndef WITH_LIBXML
if ( args_info.input_format_arg == input_format_arg_xml ) {
cerr << "The software was built with WITH_LIBXML=OFF. Please rebuild it if you want XML functionality." << endl;
exit(EXIT_FAILURE);
}
#endif // WITH_LIBXML
if ( args_info.print_relaxng_input_given && args_info.print_relaxng_output_given ) {
cerr << "error: --print-relaxng-input and --print-relaxng-output can not be used at the same time" << endl;
exit(EXIT_FAILURE);
}
if ( args_info.print_relaxng_input_given ) {
cout << fastphylo_distance_matrix_xml_relaxngstr << std::endl;
exit(EXIT_SUCCESS);
};
if ( args_info.print_relaxng_output_given ) {
cout << fastphylo_tree_count_xml_relaxngstr << std::endl;
exit(EXIT_SUCCESS);
};
//----------------------------------------------
// DISTANCE METHODS
std::vector<NJ_method> methods;
if( args_info.number_of_runs_given && args_info.input_format_arg == input_format_arg_xml ) {
cerr << "error: --number-of-runs can not be used together with input format xml." << endl;
exit(EXIT_FAILURE);
}
switch ( args_info.method_arg ) {
case method_arg_NJ:
methods.push_back(NJ);
break;
case method_arg_FNJ:
methods.push_back(FNJ);
break;
case method_arg_BIONJ:
methods.push_back(BIONJ);
break;
default:
cerr << "error: method chosen not available" << endl;
exit(EXIT_FAILURE);
}
bool printCounts = args_info.print_counts_flag;
try {
char * inputfilename = NULL;
char * outputfilename = NULL;
DataInputStream *istream;
DataOutputStream *ostream;
switch( args_info.inputs_num ) {
case 0:
break; /* inputfilename will be null and indicate stdin as input */
case 1:
inputfilename = args_info.inputs[0];
break;
default: cerr << "Error: you can at most specify one input filename" << endl;
exit(EXIT_FAILURE);
}
if( args_info.outfile_given )
outputfilename = args_info.outfile_arg;
switch ( args_info.input_format_arg ) {
case input_format_arg_phylip:
istream = new PhylipDmInputStream(inputfilename);
break;
case input_format_arg_binary: istream = new BinaryInputStream(inputfilename);
break;
#ifdef WITH_LIBXML
case input_format_arg_xml: istream = new XmlInputStream(inputfilename);
break;
#endif // WITH_LIBXML
default:
exit(EXIT_FAILURE);
}
switch (args_info.output_format_arg) {
case output_format_arg_newick:
ostream = new TreeTextOutputStream(outputfilename);
break;
case output_format_arg_xml:
ostream = new XmlOutputStream(outputfilename);
break;
default:
exit(EXIT_FAILURE);
}
//printf("%d\n", args_info.input_format_arg);
// THE DATA WE WILL PROCESS
vector<Sequence> seqs;
vector<std::string> names;
vector<DNA_b128_String> b128seqs;
Extrainfos extrainfos;
bool latestReadSuccessful = true;
vector<string> speciesnames;
readstatus status;
int run = 0;
status = END_OF_RUN;
//.........这里部分代码省略.........