예제 #1
0
 /**
  * @param DvrFile poFile
  * @param OutputStream[] paWrite Lese Datenströme im Multi Part Streaming Format vom mit
  *     dynamischer Chunk größe.
  * @throws InterruptedException
  */
 private void readstream_multipart(BufferedOutputStream[] paWrite)
     throws IOException, InterruptedException {
   byte lbFileNo = 0;
   int lnChunkSize = 0;
   byte[] laBuffer = new byte[65536];
   int lnRead = 0;
   do {
     lbFileNo = readbyte();
     if (lbFileNo >= 0) {
       lnChunkSize = readint();
       readskip(3);
       lnRead = readbyte(laBuffer, 0, lnChunkSize);
       paWrite[lbFileNo].write(laBuffer, 0, lnRead);
     }
   } while (resumeread(lbFileNo));
   ack();
   for (int i = 0; i < paWrite.length; i++) paWrite[i].close();
 }
예제 #2
0
 /**
  * @param DvrFile poFile
  * @param OutputStream poWrite Lese Datenströme im Single File Streaming Format mit statischer
  *     Chunk größe
  * @throws InterruptedException
  */
 private void readstream_singlepart(BufferedOutputStream poWrite)
     throws IOException, InterruptedException {
   int lnChunkSize = 0, lnBytes = 0;
   byte[] laBuffer = null;
   byte lbRead = 0;
   int lnUnknown = readint();
   int lnFileSize = readint();
   int lnReadSize = 0;
   lnChunkSize = readint();
   laBuffer = new byte[lnChunkSize];
   do {
     lbRead = readbyte();
     if (lbRead >= 0) {
       readskip(3);
       lnReadSize = lnFileSize - lnBytes > lnChunkSize ? lnChunkSize : lnFileSize - lnBytes;
       readbyte(laBuffer, 0, lnReadSize);
       poWrite.write(laBuffer, 0, lnReadSize);
       lnBytes += lnChunkSize;
     } else resumeread(lbRead);
   } while (lnBytes < lnFileSize);
   readbyte(laBuffer, 0, lnChunkSize - lnReadSize);
   poWrite.close();
 }