Java Code Examples for java.io.DataInput#readLine()
The following examples show how to use
java.io.DataInput#readLine() .
These examples are extracted from open source projects.
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 Project: tomee File: HttpRequestImpl.java License: 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 Project: minie File: Dictionary.java License: 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 Project: gemfirexd-oss File: VerifyHdfsDataUsingMR.java License: 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 Project: aws-doc-sdk-examples File: ListAndPurchaseReservedNodeOffering.java License: 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 Project: gemfirexd-oss File: VerifyHdfsDataUsingMR.java License: 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 Project: ignite File: HadoopDataStreamSelfTest.java License: 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 Project: rya File: RyaTypeWritable.java License: 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 Project: secure-data-service File: TenantAndIdEmittableKey.java License: 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 Project: gemfirexd-oss File: ExchangeTest.java License: 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 Project: gemfirexd-oss File: ExchangeTest.java License: 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); }