コード例 #1
0
 private static byte[] readRawData(LittleEndianInput in, int size) {
   if (size < 0) {
     throw new IllegalArgumentException("Negative size (" + size + ")");
   }
   if (size == 0) {
     return EMPTY_BYTE_ARRAY;
   }
   byte[] result = new byte[size];
   in.readFully(result);
   return result;
 }
コード例 #2
0
 private static byte[] readTail(byte[] expectedTail, LittleEndianInput in) {
   byte[] result = new byte[TAIL_SIZE];
   in.readFully(result);
   if (false) { // Quite a few examples in the unit tests which don't have the exact expected tail
     for (int i = 0; i < expectedTail.length; i++) {
       if (expectedTail[i] != result[i]) {
         System.err.println(
             "Mismatch in tail byte ["
                 + i
                 + "]"
                 + "expected "
                 + (expectedTail[i] & 0xFF)
                 + " but got "
                 + (result[i] & 0xFF));
       }
     }
   }
   return result;
 }
コード例 #3
0
ファイル: Formula.java プロジェクト: feiwei9696/POI-Android
 /**
  * When there are no array constants present, <tt>encodedTokenLen</tt>==<tt>totalEncodedLen</tt>
  *
  * @param encodedTokenLen number of bytes in the stream taken by the plain formula tokens
  * @param totalEncodedLen the total number of bytes in the formula (includes trailing encoding for
  *     array constants, but does not include 2 bytes for initial <tt>ushort encodedTokenLen</tt>
  *     field.
  * @return A new formula object as read from the stream. Possibly empty, never <code>null</code>.
  */
 public static Formula read(int encodedTokenLen, LittleEndianInput in, int totalEncodedLen) {
   byte[] byteEncoding = new byte[totalEncodedLen];
   in.readFully(byteEncoding);
   return new Formula(byteEncoding, encodedTokenLen);
 }
コード例 #4
0
 public GroupMarkerSubRecord(LittleEndianInput in, int size) {
   byte[] buf = new byte[size];
   in.readFully(buf);
   reserved = buf;
 }