Java Code Examples for java.io.DataInput#readLine()
The following examples show how to use
java.io.DataInput#readLine() .
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: HttpRequestImpl.java From tomee with Apache License 2.0 | 6 votes |
/** * reads and parses the request line * * @param in the input to be read * @throws java.io.IOException if an exception is thrown */ private boolean readRequestLine(DataInput in) throws IOException { String line; try { line = in.readLine(); // System.out.println(line); } catch (Exception e) { throw new IOException("Could not read the HTTP Request Line :" + e.getClass().getName() + " : " + e.getMessage()); } if (line == null) { return false; } StringTokenizer lineParts = new StringTokenizer(line, " "); /* [1] Parse the method */ parseMethod(lineParts); /* [2] Parse the URI */ parseURI(lineParts); return true; }
Example 2
Source File: Dictionary.java From minie with GNU General Public License v3.0 | 5 votes |
/** Loads the dictionary out of an {@link InputStream}. * Each line of the original file should contain an entry to the dictionary */ public void load(InputStream in) throws IOException { DataInput data = new DataInputStream(in); String line = data.readLine(); while (line != null) { line = line.trim(); if (line.length() > 0) { this.words.add(line); } line = data.readLine(); } }
Example 3
Source File: VerifyHdfsDataUsingMR.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
@Override public void readFields(DataInput in) throws IOException { cid = in.readInt(); cname=in.readLine(); addr=in.readLine(); tid=in.readInt(); }
Example 4
Source File: ListAndPurchaseReservedNodeOffering.java From aws-doc-sdk-examples with Apache License 2.0 | 5 votes |
private static void purchaseReservedNodeOffer() throws IOException { if (matchingNodes.size() == 0) { return; } else { System.out.println("\nPurchasing nodes."); for (ReservedNodeOffering offering : matchingNodes) { printOfferingDetails(offering); System.out.println("WARNING: purchasing this offering will incur costs."); System.out.println("Purchase this offering [Y or N]?"); DataInput in = new DataInputStream(System.in); String purchaseOpt = in.readLine(); if (purchaseOpt.equalsIgnoreCase("y")){ try { PurchaseReservedNodeOfferingRequest request = new PurchaseReservedNodeOfferingRequest() .withReservedNodeOfferingId(offering.getReservedNodeOfferingId()); ReservedNode reservedNode = client.purchaseReservedNodeOffering(request); printReservedNodeDetails(reservedNode); } catch (ReservedNodeAlreadyExistsException ex1){ } catch (ReservedNodeOfferingNotFoundException ex2){ } catch (ReservedNodeQuotaExceededException ex3){ } catch (Exception ex4){ } } } System.out.println("Finished."); } }
Example 5
Source File: VerifyHdfsDataUsingMR.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
@Override public void readFields(DataInput in) throws IOException { cid = in.readInt(); cname=in.readLine(); addr=in.readLine(); tid=in.readInt(); }
Example 6
Source File: HadoopDataStreamSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @param in Data input. * @return List of strings are returned by readLine(). * @throws IOException On error. */ @NotNull private List<String> readLineStrings(DataInput in) throws IOException { List<String> strs = new ArrayList<>(); for (String str = in.readLine(); str != null; str = in.readLine()) strs.add(str); return strs; }
Example 7
Source File: RyaTypeWritable.java From rya with Apache License 2.0 | 5 votes |
@Override public void readFields(final DataInput dataInput) throws IOException { final SimpleValueFactory vfi = SimpleValueFactory.getInstance(); final String data = dataInput.readLine(); final String dataTypeString = dataInput.readLine(); final String language = dataInput.readLine(); final IRI dataType = vfi.createIRI(dataTypeString); final String validatedLanguage = LiteralLanguageUtils.validateLanguage(language, dataType); ryatype.setData(data); ryatype.setDataType(dataType); ryatype.setLanguage(validatedLanguage); }
Example 8
Source File: TenantAndIdEmittableKey.java From secure-data-service with Apache License 2.0 | 5 votes |
@Override public void readFields(DataInput data) throws IOException { fieldNames[TENANT_FIELD] = new Text(data.readLine()); setTenantId(new Text(data.readLine())); fieldNames[ID_FIELD] = new Text(data.readLine()); setId(new Text(data.readLine())); }
Example 9
Source File: ExchangeTest.java From gemfirexd-oss with Apache License 2.0 | 3 votes |
private static void runClientMsgComm(final DataInput in, final DataOutput out) throws IOException { System.out.println("client says 'hello'"); out.writeBytes("hello\n"); out.writeBytes("I say po-ta-toe, you say...\n"); String value = in.readLine(); System.out.printf("client: server said '%1$s'%n", value); }
Example 10
Source File: ExchangeTest.java From gemfirexd-oss with Apache License 2.0 | 3 votes |
private static void runClientMsgComm(final DataInput in, final DataOutput out) throws IOException { System.out.println("client says 'hello'"); out.writeBytes("hello\n"); out.writeBytes("I say po-ta-toe, you say...\n"); String value = in.readLine(); System.out.printf("client: server said '%1$s'%n", value); }