本文整理了Java中java.io.DataInputStream.readLine()
方法的一些代码示例,展示了DataInputStream.readLine()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataInputStream.readLine()
方法的具体详情如下:
包路径:java.io.DataInputStream
类名称:DataInputStream
方法名:readLine
暂无
代码示例来源:origin: stackoverflow.com
response.setContentType("application/force-download");
response.setContentLength((int)f.length());
//response.setContentLength(-1);
response.setHeader("Content-Transfer-Encoding", "binary");
response.setHeader("Content-Disposition","attachment; filename=\"" + "xxx\"");//fileName);
...
...
File f= new File(fileName);
InputStream in = new FileInputStream(f);
BufferedInputStream bin = new BufferedInputStream(in);
DataInputStream din = new DataInputStream(bin);
while(din.available() > 0){
out.print(din.readLine());
out.print("\n");
}
代码示例来源:origin: wildfly/wildfly
System.err.println(ex);
return;
sock=sockets[i];
if(sock == null) continue;
System.out.println("Socket #" + (i + 1) + '=' + sock.getLocalAddress() + ':' + sock.getLocalPort() +
", ttl=" + sock.getTimeToLive() + ", bind interface=" + sock.getInterface());
in=new DataInputStream(System.in);
while(true) {
System.out.print("> ");
line=in.readLine();
if(line.startsWith("quit") || line.startsWith("exit"))
System.exit(0);
System.err.println(e);
代码示例来源:origin: org.fudaa.business/fudaa-common-corba
/**
* Reads in a line that has been terminated by a \n, \r,
* \r\n or EOF.
* @return a String copy of the line.
*/
public String readLine() throws IOException {
System.err.println( "warning, this function is not handle yet!");
return dis.readLine();
}
代码示例来源:origin: stackoverflow.com
String os = "abc";
System.out.println("---- unicode, big-endian");
for(byte b: os.getBytes("UTF-16BE")) {
System.out.println(b);
System.out.println("---- ba");
for(byte b: ba) {
System.out.println(b);
DataInputStream dis = new DataInputStream(bais);
System.out.println("---- dis");
String s = dis.readLine();
System.out.println(s);
System.out.println("String length is " + s.length()
代码示例来源:origin: org.apache.openejb/openejb-itests-client
public void run(){
while(true){
try{
final String line = in.readLine();
if ( line == null ) break;
System.out.println(line);
} catch (final Exception e){ break; }
}
}
});
代码示例来源:origin: stackoverflow.com
inStream = new DataInputStream(conn.getInputStream());
String str;
while ((str = inStream.readLine()) != null) {
代码示例来源:origin: stackoverflow.com
List<Class> classes = getClasses(Test.class.getClassLoader(),"test");
for(Class c:classes){
System.out.println("Class: "+c);
URL upackage = cl.getResource(pack);
DataInputStream dis = new DataInputStream((InputStream) upackage.getContent());
String line = null;
while ((line = dis.readLine()) != null) {
if(line.endsWith(".class")) {
classes.add(Class.forName(dottedPackage+"."+line.substring(0,line.lastIndexOf('.'))));
代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-itests-client
public void run(){
while(true){
try{
String line = in.readLine();
if ( line == null ) break;
System.out.println(line);
} catch (Exception e){ break; }
}
}
});
代码示例来源:origin: stackoverflow.com
inStream = new DataInputStream ( conn.getInputStream() );
String str;
while (( str = inStream.readLine()) != null){
Log.e("Debug","Server Response "+str);
reponse_data=str;
代码示例来源:origin: stackoverflow.com
try {
while(true) {
DataInputStream is = new DataInputStream(sock.getInputStream());
System.out.println("" +is.readLine());
line =is.readLine();
} // end of while
} catch(Exception ex) {}
}
代码示例来源:origin: us.ihmc/simulation-construction-set-tools
public String getStringFromExternalController()
{
if (DEBUG)
System.out.println("getting a string from the external controller");
try
{
String recievedString = in.readLine();
if (DEBUG)
System.out.println(recievedString);
return recievedString;
}
catch (IOException e)
{
e.printStackTrace();
}
return null;
}
代码示例来源:origin: stackoverflow.com
DataInputStream osRes = new DataInputStream(suProcess.getInputStream());
os.flush();
String currUid = osRes.readLine();
boolean exitSu = false;
if (null == currUid)
代码示例来源:origin: stackoverflow.com
public static void main( String[] args ) throws Exception {
int previousChoice = 0;
for( int i = 1; i <= 5; i++ ) {
System.out.println("Select an Icecream:\n1.Strawberry\n2.Vanilla\n3.Chocolate\n4.Butterscotch\n5.Black current\n6.Exit");
DataInputStream in = new DataInputStream(System.in);
int n = Integer.parseInt(in.readLine());
while (previousChoice == n) {
System.out.println("Can't select the same ice-cream twice in a row, try again.");
n = Integer.parseInt(in.readLine());
}
previousChoice = n; // save previous choice
switch( n ) {
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.aspectj
/** do line-based copying */
@SuppressWarnings("deprecation")
public static void copyStream(DataInputStream in, PrintStream out) throws IOException {
LangUtil.throwIaxIfNull(in, "in");
LangUtil.throwIaxIfNull(in, "out");
String s;
while (null != (s = in.readLine())) {
out.println(s);
}
}
代码示例来源:origin: stackoverflow.com
InputStream buildinginfo = getResources().openRawResource(R.raw.testbuilding);
DataInputStream myDIS = new DataInputStream(buildinginfo);
//you've now got an instance of DataInputStream called myDIS
String firstString = myDIS.readLine();
//voila ... your firstString variable should contain some text
代码示例来源:origin: stackoverflow.com
DataInputStream myStream = new DataInputStream(p.getInputStream());
while ((line = myStream.readLine()) != null) {
System.out.println(line);
}
代码示例来源:origin: opencb/opencga
@Test
public void testCreateFile() throws CatalogException, IOException {
String content = "This is the content\tof the file";
try {
fileManager.create(studyFqn3, File.Type.FILE, File.Format.UNKNOWN, File.Bioformat.UNKNOWN,
"data/test/myTest/myFile.txt", null, null, new File.FileStatus(File.FileStatus.READY), 0, -1, null, -1,
null, null, false, "This is the content\tof the file", null, sessionIdUser2);
fail("An error should be raised because parents is false");
} catch (CatalogException e) {
System.out.println("Correct");
}
QueryResult<File> fileQueryResult = fileManager.create(studyFqn3, File.Type.FILE, File.Format.UNKNOWN, File.Bioformat.UNKNOWN,
"data/test/myTest/myFile.txt", null, null, new File.FileStatus(File.FileStatus.READY), 0, -1, null, -1, null, null, true,
content, null, sessionIdUser2);
CatalogIOManager ioManager = catalogManager.getCatalogIOManagerFactory().get(fileQueryResult.first().getUri());
assertTrue(ioManager.exists(fileQueryResult.first().getUri()));
DataInputStream fileObject = ioManager.getFileObject(fileQueryResult.first().getUri(), -1, -1);
assertEquals(content, fileObject.readLine());
}
代码示例来源:origin: haraldk/TwelveMonkeys
/**
* See the general contract of the {@code readLine}
* method of {@code DataInput}.
* <p>
* Bytes for this operation are read from the contained input stream.
*
* @deprecated This method does not properly convert bytes to characters.
*
* @return the next line of text from this input stream.
* @exception IOException if an I/O error occurs.
* @see java.io.BufferedReader#readLine()
* @see java.io.DataInputStream#readLine()
* @noinspection deprecation
*/
public String readLine() throws IOException {
DataInputStream ds = new DataInputStream(in);
return ds.readLine();
}
}
代码示例来源:origin: stackoverflow.com
try {
// Get input from the client
DataInputStream in = new DataInputStream (server.getInputStream());
PrintStream out = new PrintStream(server.getOutputStream());
out.println("You have connected to the server.");
out.println("Welcome.");
in.readLine(); //consume first two bytes
//the rest of your code...
代码示例来源:origin: stackoverflow.com
FileInputStream fis;
final StringBuffer storedString = new StringBuffer();
try {
fis = openFileInput("out.txt");
DataInputStream dataIO = new DataInputStream(fis);
String strLine = null;
if ((strLine = dataIO.readLine()) != null) {
storedString.append(strLine);
}
dataIO.close();
fis.close();
}
catch (Exception e) {
}
内容来源于网络,如有侵权,请联系作者删除!