Java Code Examples for org.apache.hadoop.io.file.tfile.TFile.Writer#prepareAppendKey()
The following examples show how to use
org.apache.hadoop.io.file.tfile.TFile.Writer#prepareAppendKey() .
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: TestTFile.java From hadoop with Apache License 2.0 | 6 votes |
private int writePrepWithKnownLength(Writer writer, int start, int n) throws IOException { // get the length of the key String key = String.format(localFormatter, start); int keyLen = key.getBytes().length; String value = "value" + key; int valueLen = value.getBytes().length; for (int i = start; i < (start + n); i++) { DataOutputStream out = writer.prepareAppendKey(keyLen); String localKey = String.format(localFormatter, i); out.write(localKey.getBytes()); out.close(); out = writer.prepareAppendValue(valueLen); String localValue = "value" + localKey; out.write(localValue.getBytes()); out.close(); } return (start + n); }
Example 2
Source File: TestTFile.java From big-c with Apache License 2.0 | 6 votes |
private int writePrepWithKnownLength(Writer writer, int start, int n) throws IOException { // get the length of the key String key = String.format(localFormatter, start); int keyLen = key.getBytes().length; String value = "value" + key; int valueLen = value.getBytes().length; for (int i = start; i < (start + n); i++) { DataOutputStream out = writer.prepareAppendKey(keyLen); String localKey = String.format(localFormatter, i); out.write(localKey.getBytes()); out.close(); out = writer.prepareAppendValue(valueLen); String localValue = "value" + localKey; out.write(localValue.getBytes()); out.close(); } return (start + n); }
Example 3
Source File: TestTFile.java From RDFS with Apache License 2.0 | 6 votes |
private int writePrepWithKnownLength(Writer writer, int start, int n) throws IOException { // get the length of the key String key = String.format(localFormatter, start); int keyLen = key.getBytes().length; String value = "value" + key; int valueLen = value.getBytes().length; for (int i = start; i < (start + n); i++) { DataOutputStream out = writer.prepareAppendKey(keyLen); String localKey = String.format(localFormatter, i); out.write(localKey.getBytes()); out.close(); out = writer.prepareAppendValue(valueLen); String localValue = "value" + localKey; out.write(localValue.getBytes()); out.close(); } return (start + n); }
Example 4
Source File: TestTFile.java From hadoop-gpu with Apache License 2.0 | 6 votes |
private int writePrepWithKnownLength(Writer writer, int start, int n) throws IOException { // get the length of the key String key = String.format(localFormatter, start); int keyLen = key.getBytes().length; String value = "value" + key; int valueLen = value.getBytes().length; for (int i = start; i < (start + n); i++) { DataOutputStream out = writer.prepareAppendKey(keyLen); String localKey = String.format(localFormatter, i); out.write(localKey.getBytes()); out.close(); out = writer.prepareAppendValue(valueLen); String localValue = "value" + localKey; out.write(localValue.getBytes()); out.close(); } return (start + n); }
Example 5
Source File: TestTFile.java From hadoop with Apache License 2.0 | 5 votes |
private int writePrepWithUnkownLength(Writer writer, int start, int n) throws IOException { for (int i = start; i < (start + n); i++) { DataOutputStream out = writer.prepareAppendKey(-1); String localKey = String.format(localFormatter, i); out.write(localKey.getBytes()); out.close(); String value = "value" + localKey; out = writer.prepareAppendValue(-1); out.write(value.getBytes()); out.close(); } return (start + n); }
Example 6
Source File: TestTFile.java From big-c with Apache License 2.0 | 5 votes |
private int writePrepWithUnkownLength(Writer writer, int start, int n) throws IOException { for (int i = start; i < (start + n); i++) { DataOutputStream out = writer.prepareAppendKey(-1); String localKey = String.format(localFormatter, i); out.write(localKey.getBytes()); out.close(); String value = "value" + localKey; out = writer.prepareAppendValue(-1); out.write(value.getBytes()); out.close(); } return (start + n); }
Example 7
Source File: TestTFile.java From RDFS with Apache License 2.0 | 5 votes |
private int writePrepWithUnkownLength(Writer writer, int start, int n) throws IOException { for (int i = start; i < (start + n); i++) { DataOutputStream out = writer.prepareAppendKey(-1); String localKey = String.format(localFormatter, i); out.write(localKey.getBytes()); out.close(); String value = "value" + localKey; out = writer.prepareAppendValue(-1); out.write(value.getBytes()); out.close(); } return (start + n); }
Example 8
Source File: TestTFile.java From hadoop-gpu with Apache License 2.0 | 5 votes |
private int writePrepWithUnkownLength(Writer writer, int start, int n) throws IOException { for (int i = start; i < (start + n); i++) { DataOutputStream out = writer.prepareAppendKey(-1); String localKey = String.format(localFormatter, i); out.write(localKey.getBytes()); out.close(); String value = "value" + localKey; out = writer.prepareAppendValue(-1); out.write(value.getBytes()); out.close(); } return (start + n); }