如何使用$ rm -Rf node_modules/mongoose
$ npm i mongoose
$ ls -al node_modules/mongoose/tools/31000/journal
total 614400
drwxr-xr-x 5 florian staff 170 May 28 08:48 .
drwxr-xr-x 27 florian staff 918 May 28 08:48 ..
-rw-r--r-- 1 florian staff 104857600 May 24 21:27 WiredTigerLog.0000000001
-rw-r--r-- 1 florian staff 104857600 May 24 08:06 WiredTigerPreplog.0000000001
-rw-r--r-- 1 florian staff 104857600 May 24 08:06 WiredTigerPreplog.0000000002
将帖子的对象作为帖子发送并再次从服务器获取?我该怎么做才能实施HttpUrlconnection
?并且是以任何方式发送对象列表?!
谢谢
答案 0 :(得分:2)
首先你需要调用它们:
conn.setDoOutput(true); // enable write.
conn.setDoInput(true); // enable read.
用于发送数据(数据必须实现Serializable):
ObjectOutputStream out = new ObjectOutputStream( conn.getOutputStream() );
out.writeObject( data );
out.close();
用于接收数据:
ObjectInputStream ois = new ObjectInputStream( conn.getInputStream() );
data = ois.readObject();
ois.close();
答案 1 :(得分:-1)
您可以通过8个简单步骤完成此操作
allprojects
{
repositories
{
...
maven { url 'https://jitpack.io' }
}
}
dependencies
{
compile 'com.github.sangeethnandakumar:TestTube:v2.5.2'
}
public class Student
{
@Serialisable("name");
String name;
@Serialisable("subject");
String subject;
@Serialisable("rollno");
String rollno;
}
@Serialisable()是GSON库使用的anotation,只需在其中使用相同的名称即可为此处的标识符命名。好的,你现在已经完成了30%
Gson gson = new Gson();
Student s = new Student();
s.name="Sangeeth";
s.subject="Computer Science";
s.rollno="43";
String json = gson.toJson(s,Student.class);
List<DataRack> racks=new ArrayList<DataRack>();
racks.add(new DataRack("my_upload",json));
WebServer server=new WebServer(getApplicationContext());
server.setOnServerStatusListner(new WebServer.OnServerStatusListner() {
@Override
public void onServerResponded(String responce) {
}
@Override
public void onServerRevoked() {
}
});
server.connectWithPOST(MainActivity.this,"http://yourwebsite/test.php",racks);
此处记录的所有内容:https://github.com/sangeethnandakumar/TestTube
希望这可以解决