( XStream xStream,
String sName,
String sMediaType,
byte[] pBytes )
| 369 | } |
| 370 | |
| 371 | public boolean InternalCheckStream( XStream xStream, |
| 372 | String sName, |
| 373 | String sMediaType, |
| 374 | byte[] pBytes ) |
| 375 | { |
| 376 | // get input stream of substream |
| 377 | XInputStream xInput = xStream.getInputStream(); |
| 378 | if ( xInput == null ) |
| 379 | { |
| 380 | Error( "Can't get XInputStream implementation from substream '" + sName + "'!" ); |
| 381 | return false; |
| 382 | } |
| 383 | |
| 384 | byte pContents[][] = new byte[1][]; // ??? |
| 385 | |
| 386 | // read contents |
| 387 | try |
| 388 | { |
| 389 | xInput.readBytes( pContents, pBytes.length + 1 ); |
| 390 | } |
| 391 | catch( Exception e ) |
| 392 | { |
| 393 | Error( "Can't read from stream '" + sName + "', exception: " + e ); |
| 394 | return false; |
| 395 | } |
| 396 | |
| 397 | // check size of stream data |
| 398 | if ( pContents.length == 0 ) |
| 399 | { |
| 400 | Error( "SubStream '" + sName + "' reading produced disaster!" ); |
| 401 | return false; |
| 402 | } |
| 403 | |
| 404 | if ( pBytes.length != pContents[0].length ) |
| 405 | { |
| 406 | Error( "SubStream '" + sName + "' contains wrong amount of data! (" + pContents[0].length + "/" + pBytes.length + ")" ); |
| 407 | return false; |
| 408 | } |
| 409 | |
| 410 | // check stream data |
| 411 | for ( int ind = 0; ind < pBytes.length; ind++ ) |
| 412 | { |
| 413 | if ( pBytes[ind] != pContents[0][ind] ) |
| 414 | { |
| 415 | Error( "SubStream '" + sName + "' contains wrong data!" ); |
| 416 | return false; |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | |
| 421 | // check properties |
| 422 | boolean bOk = false; |
| 423 | |
| 424 | // get access to the XPropertySet interface |
| 425 | XPropertySet xPropSet = UnoRuntime.queryInterface( XPropertySet.class, xStream ); |
| 426 | if ( xPropSet != null ) |
| 427 | { |
| 428 | try |
no test coverage detected