java.io.ObjectInputStream.readLine()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中java.io.ObjectInputStream.readLine()方法的一些代码示例,展示了ObjectInputStream.readLine()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectInputStream.readLine()方法的具体详情如下:
包路径:java.io.ObjectInputStream
类名称:ObjectInputStream
方法名:readLine

ObjectInputStream.readLine介绍

[英]Reads the next line from the source stream. Lines are terminated by '\r', '\n', "\r\n" or an EOF.
[中]从源流中读取下一行。行以'\r'、'\n'、“\r\n”或EOF终止。

代码示例

代码示例来源:origin: redisson/redisson

@Override
public String readLine() throws IOException {
  return wrapped.readLine();
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public String readLine() throws IOException {
  return ois.readLine();
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public String readLine() throws IOException {
  return ois.readLine();
}

代码示例来源:origin: RuedigerMoeller/fast-serialization

@Override
public String readLine() throws IOException {
  return wrapped.readLine();
}

代码示例来源:origin: wildfly/wildfly

/** {@inheritDoc} */
@Deprecated
public String readLine() throws IOException {
  return ois.readLine();
}

代码示例来源:origin: org.apache.ignite/ignite-core

/** {@inheritDoc} */
@Override public String readLine() throws IOException {
  return ois.readLine();
}

代码示例来源:origin: org.apache.ignite/ignite-core

/** {@inheritDoc} */
@Override public String readLine() throws IOException {
  return ois.readLine();
}

代码示例来源:origin: org.jboss.marshalling/jboss-marshalling

/** {@inheritDoc} */
@Deprecated
public String readLine() throws IOException {
  return ois.readLine();
}

代码示例来源:origin: jboss-remoting/jboss-marshalling

/** {@inheritDoc} */
@Deprecated
public String readLine() throws IOException {
  return ois.readLine();
}

代码示例来源:origin: org.jboss.marshalling/jboss-marshalling-osgi

/** {@inheritDoc} */
@Deprecated
public String readLine() throws IOException {
  return ois.readLine();
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/** {@inheritDoc} */
@Deprecated
public String readLine() throws IOException {
  return ois.readLine();
}

代码示例来源:origin: babyfish-ct/babyfish

@Deprecated
@Override
public String readLine() throws IOException {
  return this.raw.readLine();
}

代码示例来源:origin: jboss-remoting/jboss-marshalling

/** {@inheritDoc} */
@Deprecated
public String readLine() throws IOException {
  return ois.readLine();
}

代码示例来源:origin: stackoverflow.com

//Writting
 ObjectOutputStream outputStream = new ObjectOutputStream(new FileOutputStream("person.out"));
 outputStream.writeObject(person);
 PrintStream pst = new PrintStream(outputStream);
 pst.append("Some static Value");
 outputStream.flush();
 outputStream.close();
 pst.close();
 // Reading
 ObjectInputStream in = new ObjectInputStream(new FileInputStream("person.out"));
 Perrson person=(Person) in.readObject();
 String staticText =in.readLine(); 
 in.close();

代码示例来源:origin: stackoverflow.com

final Socket client = serverSocket.accept(); //will set the client variable to whoever connects
final ObjectInputStream in = new ObjectInputStream(client.getInputStream()); //for getting client's input
ObjectOutputStream out = new ObjectOutputStream(client.getOutputStream()); //for sending objects to the client

BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in)); //for reading in from server's console

String input;
while((input = stdIn.readLine()) != null) { //will read in from console
  out.writeObject(input); //will send console output to connected client
}
new Thread(new Runnable() {
  public void run() {
    Object objIn;
    while(!client.isClosed()) {
      if((objIn = in.readLine()) != null) {
        System.out.println("From client: " + objIn.toString());
      }
    }
  }
}).start();

代码示例来源:origin: stackoverflow.com

try {       
     URL urlServlet = new URL("uri for your servlet");
     URLConnection con = urlServlet.openConnection();
     con.setDoInput(true);
     con.setDoOutput(true);
     con.setUseCaches(false);
     con.setRequestProperty(
       "Content-Type",
       "application/x-java-serialized-object");
     // send data to the servlet
     OutputStream outstream = con.getOutputStream();
     ObjectOutputStream oos = new ObjectOutputStream(outstream);
     oos.writeObject(uuid);
     oos.flush();
     oos.close();
     // receive result from servlet
     InputStream instr = con.getInputStream();
     ObjectInputStream inputFromServlet = new ObjectInputStream(instr);
     String name = con.getHeaderField("filename");
     File fi = new File(name);
     int i = 0;
     while ((i = inputFromServlet.read()) != -1) {
       System.out.println(inputFromServlet.readLine());
     }
     inputFromServlet.close();
     instr.close();
   } catch (Exception ex) {
     ex.printStackTrace();
   }

相关文章

ObjectInputStream类方法