use of com.facebook.buck.charset.NulTerminatedCharsetDecoder in project buck by facebook.
the class SectionTest method testCreatingFromBytesLittleEndian64Bit.
@Test
public void testCreatingFromBytesLittleEndian64Bit() throws Exception {
Section section = SectionUtils.createFromBuffer(createBuffer(SectionTestData.getLittleEndian64Bit(), 20, ByteOrder.LITTLE_ENDIAN), true, new NulTerminatedCharsetDecoder(StandardCharsets.UTF_8.newDecoder()));
assertThat(section.getOffsetInBinary(), equalTo(20));
checkValues(section);
}
use of com.facebook.buck.charset.NulTerminatedCharsetDecoder in project buck by facebook.
the class SectionUtilsTest method testCreatingFromBytes32Bits.
@Test
public void testCreatingFromBytes32Bits() throws CharacterCodingException {
ByteBuffer buffer = ByteBuffer.allocate(20 + SectionTestData.getBigEndian32Bit().length);
buffer.order(ByteOrder.BIG_ENDIAN);
buffer.position(20);
buffer.put(SectionTestData.getBigEndian32Bit());
buffer.position(20);
Section section = SectionUtils.createFromBuffer(buffer, false, new NulTerminatedCharsetDecoder(StandardCharsets.UTF_8.newDecoder()));
assertThat(section.getOffsetInBinary(), equalTo(20));
SectionTestData.checkValues(section, false);
}
use of com.facebook.buck.charset.NulTerminatedCharsetDecoder in project buck by facebook.
the class SegmentCommandTest method testCreatingFromBytes64BitsLittleEndian.
@Test
public void testCreatingFromBytes64BitsLittleEndian() throws Exception {
ByteBuffer byteBuffer = bufferWithBytes(SegmentCommandTestData.getLittleEndian64Bits(), 10);
byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
SegmentCommand command = SegmentCommandUtils.createFromBuffer(byteBuffer, new NulTerminatedCharsetDecoder(StandardCharsets.UTF_8.newDecoder()));
assertThat(command.getLoadCommandCommonFields().getOffsetInBinary(), equalTo(10));
SegmentCommandTestData.checkValues(command, true);
}
use of com.facebook.buck.charset.NulTerminatedCharsetDecoder in project buck by facebook.
the class SegmentCommandTest method testCreatingFromBytes64BitsBigEndian.
@Test
public void testCreatingFromBytes64BitsBigEndian() throws Exception {
ByteBuffer byteBuffer = bufferWithBytes(SegmentCommandTestData.getBigEndian64Bits(), 10);
byteBuffer.order(ByteOrder.BIG_ENDIAN);
SegmentCommand command = SegmentCommandUtils.createFromBuffer(byteBuffer, new NulTerminatedCharsetDecoder(StandardCharsets.UTF_8.newDecoder()));
assertThat(command.getLoadCommandCommonFields().getOffsetInBinary(), equalTo(10));
SegmentCommandTestData.checkValues(command, true);
}
use of com.facebook.buck.charset.NulTerminatedCharsetDecoder in project buck by facebook.
the class SegmentCommandTest method testCreatingFromBytes32BitsBigEndian.
@Test
public void testCreatingFromBytes32BitsBigEndian() throws Exception {
ByteBuffer byteBuffer = bufferWithBytes(SegmentCommandTestData.getBigEndian32Bits(), 10);
byteBuffer.order(ByteOrder.BIG_ENDIAN);
SegmentCommand command = SegmentCommandUtils.createFromBuffer(byteBuffer, new NulTerminatedCharsetDecoder(StandardCharsets.UTF_8.newDecoder()));
assertThat(command.getLoadCommandCommonFields().getOffsetInBinary(), equalTo(10));
SegmentCommandTestData.checkValues(command, false);
}
Aggregations