本文整理了Java中java.io.DataOutputStream.size()
方法的一些代码示例,展示了DataOutputStream.size()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataOutputStream.size()
方法的具体详情如下:
包路径:java.io.DataOutputStream
类名称:DataOutputStream
方法名:size
[英]Returns the total number of bytes written to the target stream so far.
[中]返回到目前为止写入目标流的总字节数。
代码示例来源:origin: netty/netty
public final int size() {
return out.size();
}
代码示例来源:origin: redisson/redisson
public final int size() {
return out.size();
}
代码示例来源:origin: Alluxio/alluxio
/**
* @return the number of bytes written to this stream
*/
long bytesWritten() {
if (mOutputStream == null) {
return 0;
}
return mOutputStream.size();
}
代码示例来源:origin: twitter/distributedlog
public int getPendingBytes() {
return buf.size();
}
}
代码示例来源:origin: wildfly/wildfly
public final int size() {
return out.size();
}
代码示例来源:origin: marytts/marytts
/**
* Get size of stream.
*
* @return bytes written so far in the stream. Note this is a int, not a long as you would exect. This because the underlying
* DataInputStream has a design flaw.
*/
public final int size() {
return dis.size();
}
代码示例来源:origin: marytts/marytts
/**
* Get size of stream.
*
* @return bytes written so far in the stream. Note this is a int, not a long as you would exect. This because the underlying
* DataInputStream has a design flaw.
*/
public final int size() {
return dis.size();
}
代码示例来源:origin: lealone/Lealone
public int getDataOutputStreamSize() {
return out.size();
}
代码示例来源:origin: io.netty/netty
public final int size() {
return out.size();
}
代码示例来源:origin: apache/kylin
@Override
void write(DataOutputStream out) throws IOException {
int pos = out.size();
serializer.serialize(obj, out);
bytesWritten += (out.size() - pos);
}
};
代码示例来源:origin: apache/hbase
/**
* Writes the Cell to this block
* @param cell
* @throws IOException
*/
void write(Cell cell) throws IOException{
expectState(State.WRITING);
int posBeforeEncode = this.userDataStream.size();
this.unencodedDataSizeWritten +=
this.dataBlockEncoder.encode(cell, dataBlockEncodingCtx, this.userDataStream);
this.encodedDataSizeWritten += this.userDataStream.size() - posBeforeEncode;
}
代码示例来源:origin: Alluxio/alluxio
@Override
public synchronized void flush() throws IOException {
if (mIsClosed || mDataOutputStream.size() == 0) {
// There is nothing to flush.
return;
}
try {
mDataOutputStream.flush();
} catch (IOException e) {
mRotateLogForNextWrite = true;
throw new IOException(ExceptionMessage.JOURNAL_FLUSH_FAILURE.getMessageWithUrl(
RuntimeConstants.ALLUXIO_DEBUG_DOCS_URL, mCurrentLog, e.getMessage()), e);
}
boolean overSize = mDataOutputStream.size() >= mMaxLogSize;
if (overSize || !mUfs.supportsFlush()) {
// (1) The log file is oversize, needs to be rotated. Or
// (2) Underfs is S3 or OSS, flush on S3OutputStream/OSSOutputStream will only flush to
// local temporary file,
// call close and complete the log to sync the journal entry to S3/OSS.
if (overSize) {
LOG.info("Rotating log file. size: {} maxSize: {}", mDataOutputStream.size(),
mMaxLogSize);
}
mRotateLogForNextWrite = true;
}
}
代码示例来源:origin: apache/hbase
public int write(Cell cell) throws IOException {
// checkRow uses comparator to check we are writing in order.
if (!checkRow(cell)) {
if (startOffset < 0) {
startOffset = out.size();
}
rowsOffsetBAOS.writeInt(out.size() - startOffset);
}
lastCell = cell;
return encoder.write(cell);
}
代码示例来源:origin: hierynomus/sshj
@Override
public void writeUTF(String str)
throws IOException {
final DataOutputStream dos = new DataOutputStream(rf.new RemoteFileOutputStream(fp));
try {
dos.writeUTF(str);
} finally {
dos.close();
}
fp += dos.size();
}
代码示例来源:origin: apache/hbase
if (baosDos.size() != MID_KEY_METADATA_SIZE) {
throw new IOException("Could not write mid-key metadata: size=" +
baosDos.size() + ", correct size: " + MID_KEY_METADATA_SIZE);
代码示例来源:origin: apache/hbase
public void flush() throws IOException {
int onDiskDataSize = 0;
if (startOffset >= 0) {
onDiskDataSize = out.size() - startOffset;
}
out.writeInt(rowsOffsetBAOS.size() / 4);
if (rowsOffsetBAOS.size() > 0) {
out.write(rowsOffsetBAOS.getBuffer(), 0, rowsOffsetBAOS.size());
}
out.writeInt(onDiskDataSize);
if (LOG.isTraceEnabled()) {
LOG.trace("RowNumber: " + rowsOffsetBAOS.size() / 4
+ ", onDiskDataSize: " + onDiskDataSize + ", totalOnDiskSize: "
+ (out.size() - startOffset));
}
}
代码示例来源:origin: lealone/Lealone
/**
* Close the transfer object.
*/
public void close() {
if (writableChannel != null) {
try {
if (out.size() > 4)
flush();
} catch (IOException e) {
DbException.traceThrowable(e);
} finally {
conn = null;
session = null;
writableChannel = null;
}
}
}
代码示例来源:origin: apache/hbase
compressingStream.flush();
return compressedStream.size();
} finally {
nullOutputStream.close();
代码示例来源:origin: apache/hbase
DataOutputStream dos = new DataOutputStream(baos);
c.writeNonRoot(dos);
assertEquals(c.getNonRootSize(), dos.size());
assertEquals(c.getRootSize(), dos.size());
代码示例来源:origin: apache/hbase
serializeAsWritable(dos, t);
dos.flush();
assertEquals(FixedFileTrailer.getTrailerSize(version), dos.size());
内容来源于网络,如有侵权,请联系作者删除!