本文整理了Java中java.io.BufferedInputStream.markSupported()
方法的一些代码示例,展示了BufferedInputStream.markSupported()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BufferedInputStream.markSupported()
方法的具体详情如下:
包路径:java.io.BufferedInputStream
类名称:BufferedInputStream
方法名:markSupported
[英]Tests if this input stream supports the mark
and reset
methods. The markSupported
method of BufferedInputStream
returns true
.
[中]测试此输入流是否支持mark
和reset
方法。BufferedInputStream
的markSupported
方法返回true
。
代码示例来源:origin: aws/aws-sdk-java
@Override
public boolean markSupported() {
abortIfNeeded();
return super.markSupported();
}
}
代码示例来源:origin: osmandapp/Osmand
private static Reader getUTF8Reader(InputStream f) throws IOException {
BufferedInputStream bis = new BufferedInputStream(f);
assert bis.markSupported();
bis.mark(3);
boolean reset = true;
byte[] t = new byte[3];
bis.read(t);
if (t[0] == ((byte) 0xef) && t[1] == ((byte) 0xbb) && t[2] == ((byte) 0xbf)) {
reset = false;
}
if (reset) {
bis.reset();
}
return new InputStreamReader(bis, "UTF-8");
}
代码示例来源:origin: jeremylong/DependencyCheck
if ("jar".equals(archiveExt) && in.markSupported()) {
in.mark(7);
final byte[] b = new byte[7];
代码示例来源:origin: drewnoakes/metadata-extractor
public static FileType detectFileType(@NotNull final BufferedInputStream inputStream) throws IOException
if (!inputStream.markSupported())
throw new IOException("Stream must support mark/reset");
代码示例来源:origin: marytts/marytts
assert buffInStream.markSupported();
buffInStream.mark(10000);
代码示例来源:origin: marytts/marytts
assert buffInStream.markSupported();
buffInStream.mark(10000);
代码示例来源:origin: com.amazonaws/aws-java-sdk-core
@Override
public boolean markSupported() {
abortIfNeeded();
return super.markSupported();
}
}
代码示例来源:origin: apache/pdfbox
/**
* Examines the a file's first bytes and estimates the file's type.
* <p>
* Requires a {@link BufferedInputStream} in order to mark and reset the stream to the position
* at which it was provided to this method once completed.
* <p>
* Requires the stream to contain at least eight bytes.
*
* @param inputStream a buffered input stream of the file to examine.
* @return the file type.
* @throws IOException if an IO error occurred or the input stream ended unexpectedly.
*/
public static FileType detectFileType(final BufferedInputStream inputStream) throws IOException
{
if (!inputStream.markSupported())
{
throw new IOException("Stream must support mark/reset");
}
int maxByteCount = root.getMaxDepth();
inputStream.mark(maxByteCount);
byte[] bytes = new byte[maxByteCount];
int bytesRead = inputStream.read(bytes);
if (bytesRead == -1)
{
throw new IOException("Stream ended before file's magic number could be determined.");
}
inputStream.reset();
//noinspection ConstantConditions
return root.find(bytes);
}
代码示例来源:origin: org.drools/drools-compiler
@Test
public void basicReadAndWriteObjectTest() throws Exception {
DataObject thingy = new DataObject();
thingy.type = 'a';
thingy.time = new Date().getTime();
thingy.strCount = "1";
byte [] bytes = marshallThingy(thingy);
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
BufferedInputStream bis = new BufferedInputStream(bais);
ObjectInputStream stream = new ObjectInputStream(bis);
DataObject unmaThingy = new DataObject();
unmaThingy.type = stream.readChar();
unmaThingy.time = stream.readLong();
assertTrue( "Mark/reset is not supported", bis.markSupported() );
bis.mark(8);
int [] intBytes = new int [4];
intBytes[0] = bis.read();
intBytes[1] = bis.read();
intBytes[2] = bis.read();
intBytes[3] = bis.read();
if ((intBytes[0] | intBytes[1] | intBytes[2] | intBytes[3] ) < 0) {
bis.reset();
}
unmaThingy.strCount = stream.readUTF();
assertTrue( thingy.equals(unmaThingy) );
}
代码示例来源:origin: goGPS-Project/goGPS_Java
@Override
public boolean markSupported() {
return is.markSupported();
}
代码示例来源:origin: com.gitee.ainilili/nocat
@Override
public boolean markSupported() {
return inputBuffer.markSupported();
}
代码示例来源:origin: dkpro/dkpro-jwpl
@Override
public boolean markSupported() {
return result.markSupported();
}
代码示例来源:origin: sakaiproject/sakai
public boolean markSupported() {
return in.markSupported();
}
代码示例来源:origin: com.ksyun/ksc-sdk-java-core
@Override
public boolean markSupported() {
abortIfNeeded();
return super.markSupported();
}
}
代码示例来源:origin: Nextdoor/bender
@Override
public boolean markSupported() {
abortIfNeeded();
return super.markSupported();
}
}
代码示例来源:origin: com.qcloud/cos_api
@Override
public boolean markSupported() {
abortIfNeeded();
return super.markSupported();
}
}
代码示例来源:origin: org.apache.hadoop/hadoop-aws-tlnd
@Override
public boolean markSupported() {
abortIfNeeded();
return super.markSupported();
}
}
代码示例来源:origin: org.jboss.forge/forge-test-harness
@Override
public boolean markSupported()
{
requireCurrent();
return current.markSupported();
}
代码示例来源:origin: org.keycloak/keycloak-client-registration-cli
@Override
public boolean markSupported() {
log("markSupported()");
return super.markSupported();
}
代码示例来源:origin: tencentyun/cos-java-sdk-v5
@Override
public boolean markSupported() {
abortIfNeeded();
return super.markSupported();
}
}
内容来源于网络,如有侵权,请联系作者删除!