Java Code Examples for org.apache.hadoop.io.DataInputBuffer#getData()
The following examples show how to use
org.apache.hadoop.io.DataInputBuffer#getData() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IFile.java From hadoop with Apache License 2.0 | 6 votes |
public void nextRawValue(DataInputBuffer value) throws IOException { final byte[] valBytes = (value.getData().length < currentValueLength) ? new byte[currentValueLength << 1] : value.getData(); int i = readData(valBytes, 0, currentValueLength); if (i != currentValueLength) { throw new IOException ("Asked for " + currentValueLength + " Got: " + i); } value.reset(valBytes, currentValueLength); // Record the bytes read bytesRead += currentValueLength; ++recNo; ++numRecordsRead; }
Example 2
Source File: IFile.java From big-c with Apache License 2.0 | 6 votes |
public void nextRawValue(DataInputBuffer value) throws IOException { final byte[] valBytes = (value.getData().length < currentValueLength) ? new byte[currentValueLength << 1] : value.getData(); int i = readData(valBytes, 0, currentValueLength); if (i != currentValueLength) { throw new IOException ("Asked for " + currentValueLength + " Got: " + i); } value.reset(valBytes, currentValueLength); // Record the bytes read bytesRead += currentValueLength; ++recNo; ++numRecordsRead; }
Example 3
Source File: IFile.java From incubator-tez with Apache License 2.0 | 6 votes |
public void nextRawValue(DataInputBuffer value) throws IOException { final byte[] valBytes = ((value.getData().length < currentValueLength) || (value.getData() == keyBytes)) ? new byte[currentValueLength << 1] : value.getData(); int i = readData(valBytes, 0, currentValueLength); checkState((i == currentValueLength), "Asked for %d got %d", currentValueLength, i); value.reset(valBytes, currentValueLength); // Record the bytes read bytesRead += currentValueLength; ++recNo; ++numRecordsRead; }
Example 4
Source File: IFile.java From tez with Apache License 2.0 | 6 votes |
public void nextRawValue(DataInputBuffer value) throws IOException { final byte[] valBytes; if ((value.getData().length < currentValueLength) || (value.getData() == keyBytes)) { valBytes = createLargerArray(currentValueLength); } else { valBytes = value.getData(); } int i = readData(valBytes, 0, currentValueLength); if (i != currentValueLength) { throw new IOException(String.format(INCOMPLETE_READ, currentValueLength, i)); } value.reset(valBytes, currentValueLength); // Record the bytes read bytesRead += currentValueLength; ++recNo; ++numRecordsRead; }
Example 5
Source File: PipelinedSorter.java From incubator-tez with Apache License 2.0 | 5 votes |
public void reset(DataInputBuffer clone) { byte[] data = clone.getData(); int start = clone.getPosition(); int length = clone.getLength(); resize(length); System.arraycopy(data, start, buffer, 0, length); super.reset(buffer, 0, length); }
Example 6
Source File: BufferUtils.java From tez with Apache License 2.0 | 5 votes |
public static int compare(DataInputBuffer buf1, DataInputBuffer buf2) { byte[] b1 = buf1.getData(); byte[] b2 = buf2.getData(); int s1 = buf1.getPosition(); int s2 = buf2.getPosition(); int l1 = buf1.getLength(); int l2 = buf2.getLength(); return FastByteComparisons.compareTo(b1, s1, l1, b2, s2, l2); }
Example 7
Source File: BufferUtils.java From tez with Apache License 2.0 | 5 votes |
public static int compare(DataInputBuffer buf1, DataOutputBuffer buf2) { byte[] b1 = buf1.getData(); byte[] b2 = buf2.getData(); int s1 = buf1.getPosition(); int s2 = 0; int l1 = buf1.getLength(); int l2 = buf2.getLength(); return FastByteComparisons.compareTo(b1, s1, (l1 - s1), b2, s2, l2); }
Example 8
Source File: BufferUtils.java From tez with Apache License 2.0 | 5 votes |
public static void copy(DataInputBuffer src, DataOutputBuffer dst) throws IOException { byte[] b1 = src.getData(); int s1 = src.getPosition(); int l1 = src.getLength(); dst.reset(); dst.write(b1, s1, l1 - s1); }
Example 9
Source File: PipelinedSorter.java From tez with Apache License 2.0 | 5 votes |
@SuppressWarnings("unused") public void copy(DataInputBuffer clone) { byte[] data = clone.getData(); int start = clone.getPosition(); int length = clone.getLength() - start; resize(length); System.arraycopy(data, start, buffer, 0, length); super.reset(buffer, 0, length); }
Example 10
Source File: TestCryptoStreams.java From hadoop with Apache License 2.0 | 4 votes |
public FakeInputStream(DataInputBuffer in) { data = in.getData(); length = in.getLength(); }
Example 11
Source File: TestCryptoStreams.java From big-c with Apache License 2.0 | 4 votes |
public FakeInputStream(DataInputBuffer in) { data = in.getData(); length = in.getLength(); }
Example 12
Source File: PipelinedSorter.java From tez with Apache License 2.0 | 4 votes |
public void reset(DataInputBuffer clone) { byte[] data = clone.getData(); int start = clone.getPosition(); int length = clone.getLength() - start; super.reset(data, start, length); }