add: http.postMultipart
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
package com.stardust.pio;
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/12/5.
|
||||
*/
|
||||
|
||||
public interface PFileInterface {
|
||||
String getPath();
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class PFiles {
|
||||
static final int DEFAULT_BUFFER_SIZE = 8192;
|
||||
static final String DEFAULT_ENCODING = Charset.defaultCharset().name();
|
||||
|
||||
public static Object open(String path, String mode, String encoding, int bufferSize) {
|
||||
public static PFileInterface open(String path, String mode, String encoding, int bufferSize) {
|
||||
switch (mode) {
|
||||
case "r":
|
||||
return new PReadableTextFile(path, encoding, bufferSize);
|
||||
|
||||
@@ -8,12 +8,13 @@ import java.util.List;
|
||||
* Created by Stardust on 2017/4/1.
|
||||
*/
|
||||
|
||||
public class PReadableTextFile implements Closeable {
|
||||
public class PReadableTextFile implements Closeable, PFileInterface {
|
||||
|
||||
private BufferedReader mBufferedReader;
|
||||
private FileInputStream mFileInputStream;
|
||||
private int mBufferingSize;
|
||||
private String mEncoding;
|
||||
private String mPath;
|
||||
|
||||
public PReadableTextFile(String path) {
|
||||
this(path, PFiles.DEFAULT_ENCODING);
|
||||
@@ -26,6 +27,7 @@ public class PReadableTextFile implements Closeable {
|
||||
public PReadableTextFile(String path, String encoding, int bufferingSize) {
|
||||
mEncoding = encoding;
|
||||
mBufferingSize = bufferingSize;
|
||||
mPath = path;
|
||||
try {
|
||||
mFileInputStream = new FileInputStream(path);
|
||||
} catch (FileNotFoundException e) {
|
||||
@@ -103,4 +105,9 @@ public class PReadableTextFile implements Closeable {
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return mPath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import static com.stardust.pio.PFiles.DEFAULT_BUFFER_SIZE;
|
||||
* Created by Stardust on 2017/4/1.
|
||||
*/
|
||||
|
||||
public class PWritableTextFile implements Closeable {
|
||||
public class PWritableTextFile implements Closeable, PFileInterface {
|
||||
|
||||
public static PWritableTextFile open(String path, String encoding, int bufferSize) {
|
||||
return new PWritableTextFile(path, encoding, bufferSize, false);
|
||||
@@ -35,8 +35,10 @@ public class PWritableTextFile implements Closeable {
|
||||
}
|
||||
|
||||
private BufferedWriter mBufferedWriter;
|
||||
private String mPath;
|
||||
|
||||
public PWritableTextFile(String path, String encoding, int bufferingSize, boolean append) {
|
||||
mPath = path;
|
||||
if (bufferingSize <= 0) {
|
||||
bufferingSize = DEFAULT_BUFFER_SIZE;
|
||||
}
|
||||
@@ -116,4 +118,8 @@ public class PWritableTextFile implements Closeable {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return mPath;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user