本文整理了Java中java.io.OutputStream.<init>()
方法的一些代码示例,展示了OutputStream.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OutputStream.<init>()
方法的具体详情如下:
包路径:java.io.OutputStream
类名称:OutputStream
方法名:<init>
[英]Default constructor.
[中]默认构造函数。
代码示例来源:origin: stackoverflow.com
public void encode(File file, OutputStream base64OutputStream) {
InputStream is = new FileInputStream(file);
OutputStream out = new Base64OutputStream(base64OutputStream)
IOUtils.copy(is, out);
is.close();
out.close();
}
代码示例来源:origin: stackoverflow.com
...
ByteArrayOutputStream os = new ByteArrayOutputStream();
OutputStream b64 = new Base64.OutputStream(os);
ImageIO.write(bi, "png", b64);
String result = os.toString("UTF-8");
代码示例来源:origin: stackoverflow.com
OutputStream outputStream = new OutputStream(clientSocket.getOutputStream(),
true);
代码示例来源:origin: stackoverflow.com
OutputStream outstream = new OutputStream(urlConnection.getOutputStream());
代码示例来源:origin: stackoverflow.com
OutputStream output = new OutputStream("SomePath");
代码示例来源:origin: stackoverflow.com
File file = new TFile("archive.tar.gz/README.TXT");
OutputStream out = new TFileOutputStream(file);
try {
// Write archive entry contents here.
...
} finally {
out.close();
}
代码示例来源:origin: stackoverflow.com
OutputStream os = new OutputStream(file);
OutputStreamWriter writer = new OutputStreamWriter(os, "UTF-8");
代码示例来源:origin: stackoverflow.com
public void encode(File file, OutputStream base64OutputStream) {
InputStream is = new FileInputStream(file);
OutputStream out = new Base64OutputStream(base64OutputStream)
IOUtils.copy(is, out);
is.close();
out.close();
}
代码示例来源:origin: stackoverflow.com
OutputStream os = new LogOutputStream();
PrintStream ps = new PrintStream(os);
System.setOut(ps);
代码示例来源:origin: stackoverflow.com
public void encode(File file, OutputStream base64OutputStream) {
InputStream is = new FileInputStream(file);
OutputStream out = new Base64OutputStream(base64OutputStream)
IOUtils.copy(is, out);
is.close();
out.close();
}
代码示例来源:origin: stackoverflow.com
public byte[] crtZipByteArray(ByteArrayInputStream data,ZipEntry entry) throws IOException{
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
OutputStream fileOut = new FileOutputStream("filename.zip");
OutputStream teeOut = new TeeOutputStream(byteArrayOut, fileOut);
ZipOutputStream zos = new ZipOutputStream(teeOut);
.....
}
代码示例来源:origin: stackoverflow.com
OutputStream outstream = new OutputStream(socket.getOutputStream());
PrintWriter out = new PrintWriter(outstream);
out.write("Hello Server!");
代码示例来源:origin: stackoverflow.com
OutputStream printStream = new OutputStream(new FileOutputStream("someText.txt", true));
System.setOut(printStream);
代码示例来源:origin: stackoverflow.com
File file = new File("abc.xlsx");
FileWriter writer = new FileWriter(file);
OutputStream outputStream = new WriterOutputStream(writer);
PrintStream printStream = new PrintStream(outputStream);
代码示例来源:origin: stackoverflow.com
StringBuilder sb = new StringBuilder();
try (OutputStream out = new Base64Encoder(sb)) {
javax.imageio.ImageIO.write(image, "png", out);
} catch (IOException e) {
throw new RuntimeException(e);
}
String imageData = sb.toString();
代码示例来源:origin: stackoverflow.com
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = new CompositeOutputStream(new DataOutputStream(...), baos);
os.write(...);
byte[] data = baos.toByteArray();
String dataAsString = new String(data, "UTF-8"); // or whatever encoding you are using
// etc.
代码示例来源:origin: stackoverflow.com
// Directory to save log files in
File logDir = new File("/var/log/myapp");
// Name of log file
String logFileName = locations[0][0] + "-" + locations[0][1] + "-output.txt";
// Actual log file
File logFile = new File(logDir, logFileName);
// File stream
OutputStream fileStream = new FileOutputStream(logFile);
// Stdout
OutputStream stdioStream = System.out;
// A stream redirecting output to both supplied streams
OutputStream combinedStream = new TeeOutputStream(stdioStream, fileStream);
// Finally use the resulting stream
System.setOut(new PrintStream(combinedStream));
代码示例来源:origin: stackoverflow.com
@FXML
protected void onClick(ActionEvent event) throws FileNotFoundException{
Properties p = new Properties();
InputStream is = new InputStream("accounts.txt");
p.load(is);
is.close();
String number = banknumber.getText();
String origbal = p.getProperty(number);
int addtobal = Integer.parseInt(deposited.getText());
if (origbal != null)
p.setProperty(number, Integer.parseInt(origbal) + addtobal);
OutputStream os = new OutputStream("accounts.txt");
p.store(os);
os.close();
}
代码示例来源:origin: com.sequoiadb/sequoiadb-driver
public String hex() {
final StringBuilder buf = new StringBuilder();
try {
pipe(new OutputStream() {
@Override
public void write(int b) {
String s = Integer.toHexString(0xff & b);
if (s.length() < 2) buf.append("0");
buf.append(s);
}
});
} catch (IOException ioe) {
throw new RuntimeException("impossible");
}
return buf.toString();
}
代码示例来源:origin: stackoverflow.com
try (InputStream is = new InputStream(socket);
OutputStream os = new OutputStream(socket);
ObjectInputStream ois = new ObjectInputStream(is)
ObjectOutputStream oos = new ObjectInputStream(os)) {
// Do stuff here
}
内容来源于网络,如有侵权,请联系作者删除!