Package org.apache.poi.util

Examples of org.apache.poi.util.LittleEndianByteArrayInputStream


        + "00 00 00 "      // Array data: 1 col, 1 row
        + "02 01 00 00 35" // elem (type=string, len=1, "5")
    );
    assertTrue(Arrays.equals(expData, data));
    int initSize = Ptg.getEncodedSizeWithoutArrayData(ptgs);
    Ptg[] ptgs2 = Ptg.readTokens(initSize, new LittleEndianByteArrayInputStream(data));
    confirmTokenClasses(ptgs2, ArrayPtg.class, IntPtg.class, FuncVarPtg.class);
  }
View Full Code Here


    // Confirm expected size of first record, and ushort strLen.
    assertEquals(MAX_BIFF_DATA, LittleEndian.getUShort(ser, 2));
    assertEquals(TEXT_LEN, LittleEndian.getUShort(ser, 4));

    // Confirm first few bytes of ContinueRecord
    LittleEndianInput crIn = new LittleEndianByteArrayInputStream(ser, (MAX_BIFF_DATA + 4));
    int nCharsInFirstRec = MAX_BIFF_DATA - (2 + 1); // strLen, optionFlags
    int nCharsInSecondRec = TEXT_LEN - nCharsInFirstRec;
    assertEquals(ContinueRecord.sid, crIn.readUShort());
    assertEquals(1 + nCharsInSecondRec, crIn.readUShort());
    assertEquals(0, crIn.readUByte());
    assertEquals('N', crIn.readUByte());
    assertEquals('O', crIn.readUByte());

    // re-read and make sure string value is the same
    RecordInputStream in = TestcaseRecordInputStream.create(ser);
    StringRecord sr2 = new StringRecord(in);
    assertEquals(sb.toString(), sr2.getString());
View Full Code Here

    g = createFromStreamDump("[03, 03, 00, 00, 00, 00, 00, 00, C0, 00, 00, 00, 00, 00, 00, 46]");
    assertEquals("00000303-0000-0000-C000-000000000046", g.formatAsString());
  }

  private static GUID createFromStreamDump(String s) {
    return new GUID(new LittleEndianByteArrayInputStream(HexRead.readFromString(s)));
  }
View Full Code Here

  /**
   * Prepends a mock record identifier to the supplied data and opens a record input stream
   */
  public static LittleEndianInput createLittleEndian(byte[] data) {
    return new LittleEndianByteArrayInputStream(data);

  }
View Full Code Here

        + "00 00 00 "      // Array data: 1 col, 1 row
        + "02 01 00 00 35" // elem (type=string, len=1, "5")
    );
    assertTrue(Arrays.equals(expData, data));
    int initSize = Ptg.getEncodedSizeWithoutArrayData(ptgs);
    Ptg[] ptgs2 = Ptg.readTokens(initSize, new LittleEndianByteArrayInputStream(data));
    confirmTokenClasses(ptgs2, ArrayPtg.class, IntPtg.class, FuncVarPtg.class);
  }
View Full Code Here

        + "00 00 00 "      // Array data: 1 col, 1 row
        + "02 01 00 00 35" // elem (type=string, len=1, "5")
    );
    assertTrue(Arrays.equals(expData, data));
    int initSize = Ptg.getEncodedSizeWithoutArrayData(ptgs);
    Ptg[] ptgs2 = Ptg.readTokens(initSize, new LittleEndianByteArrayInputStream(data));
    confirmTokenClasses(ptgs2, ArrayPtg.class, IntPtg.class, FuncVarPtg.class);
  }
View Full Code Here

        new DataOutputStream(baos).writeLong(_d4);
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
      byte[] buf = baos.toByteArray();
      return new LittleEndianByteArrayInputStream(buf).readLong();
    }
View Full Code Here

 
  private Formula(byte[] byteEncoding, int encodedTokenLen) {
    _byteEncoding = byteEncoding;
    _encodedTokenLen = encodedTokenLen;
    if (false) { // set to true to eagerly check Ptg decoding
        LittleEndianByteArrayInputStream in = new LittleEndianByteArrayInputStream(byteEncoding);
        Ptg.readTokens(encodedTokenLen, in);
        int nUnusedBytes = _byteEncoding.length - in.getReadIndex();
        if (nUnusedBytes > 0) {
          // TODO - this seems to occur when IntersectionPtg is present
            // This example file "IntersectionPtg.xls"
            // used by test: TestIntersectionPtg.testReading()
            // has 10 bytes unused at the end of the formula
View Full Code Here

    in.readFully(byteEncoding);
    return new Formula(byteEncoding, encodedTokenLen);
  }
 
  public Ptg[] getTokens() {
    LittleEndianInput in = new LittleEndianByteArrayInputStream(_byteEncoding);
    return Ptg.readTokens(_encodedTokenLen, in);
  }
View Full Code Here

    g = createFromStreamDump("[03, 03, 00, 00, 00, 00, 00, 00, C0, 00, 00, 00, 00, 00, 00, 46]");
    assertEquals("00000303-0000-0000-C000-000000000046", g.formatAsString());
  }

  private static GUID createFromStreamDump(String s) {
    return new GUID(new LittleEndianByteArrayInputStream(HexRead.readFromString(s)));
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.util.LittleEndianByteArrayInputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.