本文整理汇总了Java中com.sun.xml.internal.messaging.saaj.util.ByteInputStream类的典型用法代码示例。如果您正苦于以下问题:Java ByteInputStream类的具体用法?Java ByteInputStream怎么用?Java ByteInputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ByteInputStream类属于com.sun.xml.internal.messaging.saaj.util包,在下文中一共展示了ByteInputStream类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: ZipFullEntry
import com.sun.xml.internal.messaging.saaj.util.ByteInputStream; //导入依赖的package包/类
public ZipFullEntry(ZipInputStream stream, ZipEntry e, boolean isParentJarFile) {
insideJar = isParentJarFile;
entry = e;
contentsGetter = () -> {
try {
long size = e.getSize();
// Note: This will fail to properly read 2gb+ files, but we have other problems if that's in this JAR file.
if (size <= 0) {
return Optional.empty();
}
byte[] buffer = new byte[(int) size];
stream.read(buffer);
return Optional.of(new ByteInputStream(new byte[(int) e.getSize()], buffer.length));
} catch (IOException ex) {
Logger.getLogger(ZipFullEntry.class.getName()).log(Level.SEVERE, null, ex);
return Optional.empty();
}
};
}
开发者ID:Adobe-Consulting-Services,项目名称:aem-epic-tool,代码行数:20,代码来源:ZipFullEntry.java
示例2: uncompressString
import com.sun.xml.internal.messaging.saaj.util.ByteInputStream; //导入依赖的package包/类
public static String uncompressString(byte[] bytes) {
try {
ByteInputStream bis = new ByteInputStream(bytes, bytes.length);
ZipInputStream zis = new ZipInputStream(bis);
ZipEntry entry = zis.getNextEntry();
int byteSize = 5000, len = 0;
byte[] contentBytes = new byte[byteSize];
ByteArrayOutputStream bufStream = new ByteArrayOutputStream();
if ( entry != null ) {
while ( (len = zis.read(contentBytes)) != -1 ) {
bufStream.write(contentBytes, 0, len);
}
String content = new String(bufStream.toByteArray(), "utf8");
return content;
}
} catch (IOException e) {
logger.warn("Failed to unzip string.", e);
}
return null;
}
开发者ID:wangqi,项目名称:gameserver,代码行数:21,代码来源:IOUtil.java
示例3: uncompressStringZlib
import com.sun.xml.internal.messaging.saaj.util.ByteInputStream; //导入依赖的package包/类
public static String uncompressStringZlib(byte[] bytes) {
try {
ByteInputStream bis = new ByteInputStream(bytes, bytes.length);
InflaterInputStream zis = new InflaterInputStream(bis);
int byteSize = 5000, len = 0;
byte[] contentBytes = new byte[byteSize];
ByteArrayOutputStream bufStream = new ByteArrayOutputStream();
while ( (len = zis.read(contentBytes)) != -1 ) {
bufStream.write(contentBytes, 0, len);
}
String content = new String(bufStream.toByteArray(), "utf8");
return content;
} catch (IOException e) {
logger.warn("Failed to unzip string.", e);
}
return null;
}
开发者ID:wangqi,项目名称:gameserver,代码行数:18,代码来源:IOUtil.java
示例4: insertBinaryEntry
import com.sun.xml.internal.messaging.saaj.util.ByteInputStream; //导入依赖的package包/类
@BeforeClass
void insertBinaryEntry() throws IOException {
bindDummyContext();
try {
// Create a dummy binary entry for testing file creation
BinaryInfo binaryInfo = binaryStore.addBinary(new ByteInputStream(new byte[]{1, 2, 3}, 3));
sha1 = binaryInfo.getSha1();
} finally {
unbindDummyContext();
}
}
开发者ID:alancnet,项目名称:artifactory,代码行数:12,代码来源:FileServiceSpecialCharsTest.java
示例5: getClip
import com.sun.xml.internal.messaging.saaj.util.ByteInputStream; //导入依赖的package包/类
private Clip getClip() {
Clip c = null;
try {
AudioInputStream ais=AudioSystem.getAudioInputStream(
new ByteInputStream(samples,samples.length));
c = (Clip) AudioSystem.getLine(new Line.Info(Clip.class));
c.open(ais);
} catch (Exception e) {
e.printStackTrace();
}
return c;
}
开发者ID:pi0,项目名称:MSP,代码行数:13,代码来源:GSound.java
示例6: getContentAsStream
import com.sun.xml.internal.messaging.saaj.util.ByteInputStream; //导入依赖的package包/类
public InputStream getContentAsStream() throws IOException {
if (source != null) {
InputStream is = null;
// Allow message to be transcode if so requested
if (source instanceof StreamSource && !isFastInfoset()) {
is = ((StreamSource) source).getInputStream();
}
else if (FastInfosetReflection.isFastInfosetSource(source) &&
isFastInfoset())
{
try {
// InputStream is = source.getInputStream()
is = FastInfosetReflection.FastInfosetSource_getInputStream(source);
}
catch (Exception e) {
throw new IOException(e.toString());
}
}
if (is != null) {
if (lazyContentLength) {
return is;
}
if (!(is instanceof ByteInputStream)) {
log.severe("SAAJ0546.soap.stream.incorrect.type");
throw new IOException("Internal error: stream not of the right type");
}
return (ByteInputStream) is;
}
// need to do something here for reader...
// for now we'll see if we can fallback...
}
ByteOutputStream b = new ByteOutputStream();
Envelope env = null;
try {
env = (Envelope) getEnvelope();
env.output(b, isFastInfoset());
}
catch (SOAPException soapException) {
log.severe("SAAJ0547.soap.cannot.externalize");
throw new SOAPIOException(
"SOAP exception while trying to externalize: ",
soapException);
}
return b.newInputStream();
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:52,代码来源:SOAPPartImpl.java
示例7: getInputStream
import com.sun.xml.internal.messaging.saaj.util.ByteInputStream; //导入依赖的package包/类
@Override
public InputStream getInputStream() throws IOException {
byte[] bytes = getContent().toString().getBytes();
return new ByteInputStream(bytes, bytes.length);
}
开发者ID:troven,项目名称:scorpio4core,代码行数:6,代码来源:Asset.java
示例8: received
import com.sun.xml.internal.messaging.saaj.util.ByteInputStream; //导入依赖的package包/类
public void received(Connection connection, Object object) {
if (object instanceof CameraMessage) {
CameraMessage message = (CameraMessage) object;
CameraConnection cameraConnection = (CameraConnection) connection;
switch (message.messageId) {
case UPDATE_CAR:
UpdateCarMessage updateCarMsg = (UpdateCarMessage) message;
if (!cameraConnection.isValidUpdateCarMessage(updateCarMsg.seqNr))
break;
_moderator.updateCar(updateCarMsg.carId, updateCarMsg.posX, updateCarMsg.posY,
updateCarMsg.direction);
break;
case CAR_DETECTED:
CarDetectedMessage carDetectedMsg = (CarDetectedMessage) message;
// get the car image
BufferedImage carImage = null;
if (carDetectedMsg.image != null && carDetectedMsg.image.length > 0) {
try {
InputStream in = new ByteInputStream(carDetectedMsg.image,
carDetectedMsg.image.length);
carImage = ImageIO.read(in);
in.close();
} catch (IOException e) {
_logger.error("Exception caught while reading car image!", e);
}
} else {
_logger.error("No image received for car with id: {}", carDetectedMsg.carId);
}
if (carImage != null) {
Car<Player> car = new Car<Player>(carDetectedMsg.carId, new Position(
carDetectedMsg.posX, carDetectedMsg.posY), new Direction(
carDetectedMsg.direction), carImage);
_moderator.carDetected(car);
}
break;
case CONFIGURE_MAP:
ConfigureMapMessage configureMapMsg = (ConfigureMapMessage) message;
_moderator.configureMap(configureMapMsg.sizeX, configureMapMsg.sizeY);
break;
case DETECTION_FINISHED:
_moderator.detectionFinished();
break;
default:
_logger.warn("Camera message with id: {} not known!", message.messageId);
break;
}
} else if (object instanceof FrameworkMessage.KeepAlive) {
// _logger.debug("Received Camera keepAlive ...");
}
}
开发者ID:lumannnn,项目名称:AudioRacer,代码行数:58,代码来源:CameraServerListener.java
注:本文中的com.sun.xml.internal.messaging.saaj.util.ByteInputStream类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论