inputStream扩展InputStream的新类(inputStream new class that extends InputStream)
我创建了一个扩展InputStream的新类,并且必须使用@Override read()。 我试图使用方法read(int b),但是当我使用它时,它转到方法read(),我不能使用参数,我转过来。
这是我的代码:
public class Run { public static void main(String[] args) { DFSMaze3dGenerator mg = new DFSMaze3dGenerator(); try { Maze3d maze3d = mg.generate(1, 5, 5); maze3d.print3DMaze(); OutputStream out = new MyCompressorOutputStream( new FileOutputStream("1.maz")); out.write(maze3d.toByteArray()); byte[] arr = maze3d.toByteArray(); System.out.println(""); for (int i = 0; i < arr.length; i++) { System.out.print(arr[i] + ","); } out.close(); InputStream in = new MyDecompressorInputStream(new FileInputStream( "1.maz")); byte b[] = new byte[maze3d.toByteArray().length]; in.read(b); in.close(); Maze3d loaded = new Maze3d(b); System.out.println(loaded.equals(maze3d)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
我在使用该方法时如何使用该参数:read(b); ???
public class MyDecompressorInputStream extends InputStream { InputStream in; int count; boolean even = false; public MyDecompressorInputStream(InputStream in) { super(); this.in = in; } @Override public int read() throws IOException { return 100; } }
I made a new class that extends InputStream and has to @Override read(). I am trying to use the method read(int b), but when I use it,it goes to the method read() and I cant use the parameter,I passed over.
Here is my code:
public class Run { public static void main(String[] args) { DFSMaze3dGenerator mg = new DFSMaze3dGenerator(); try { Maze3d maze3d = mg.generate(1, 5, 5); maze3d.print3DMaze(); OutputStream out = new MyCompressorOutputStream( new FileOutputStream("1.maz")); out.write(maze3d.toByteArray()); byte[] arr = maze3d.toByteArray(); System.out.println(""); for (int i = 0; i < arr.length; i++) { System.out.print(arr[i] + ","); } out.close(); InputStream in = new MyDecompressorInputStream(new FileInputStream( "1.maz")); byte b[] = new byte[maze3d.toByteArray().length]; in.read(b); in.close(); Maze3d loaded = new Maze3d(b); System.out.println(loaded.equals(maze3d)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
How can i use the parameter when i use the method: read(b); ???
public class MyDecompressorInputStream extends InputStream { InputStream in; int count; boolean even = false; public MyDecompressorInputStream(InputStream in) { super(); this.in = in; } @Override public int read() throws IOException { return 100; } }
原文:https://stackoverflow.com/questions/32442435
最满意答案
也许这就是你要找的东西: http : //www.webshotspro.com/ (它不是免费但很便宜)
Maybe this will be what you are looking for: http://www.webshotspro.com/ (it's not free but quite cheap)
相关问答
更多-
如何使用ruby和unix服务器截取网页截图?(How do I take screenshots of web pages using ruby and a unix server? [closed])[2021-11-26]
Selenium RC有一个Ruby界面,可以使用capture_screenshot(文件名,kwargs)抓取屏幕截图。 然后,您必须将其缩小为缩略图。 Selenium RC has a Ruby interface and can grab a screenshot using capture_screenshot(filename,kwargs). You'd then have to shrink it to a thumbnail. -
iPhone应用程序批准后,在iTunes Connect中编辑屏幕截图(Editing screenshots in iTunes Connect after iOS app was approved)[2023-01-13]
目前的立场已经改变为: 自2013年1月9日起,应用程式萤幕撷取画面会在您的应用程式获得批准后被锁定在iTunes Connect中。 当您将更新的二进制文件提交给现有应用程序或新应用程序时,可能会上传新的屏幕截图。 Apple support now got back with the (somehow not too satisfactory) answer: If your app is currently for sale on the App Store, you will need to sub ... -
将客户端应用程序更新推送到某人的计算机只会危及用户的计算机和数据。 但是,您无法自动将更新推送到其他人的服务器。 你不知道他们的环境是什么,以及通过推动你的更新可以打破什么。 鉴于您的员工将使用您的应用将内容发布给用户,您将面临用户业务风险。 Pushing a client app update to somebody's computer is putting to risk only that user's computer and data. However, you can't automatic ...
-
您应该切换到使用sequelizer ,即AppHarbor数据库即服务附加组件。 尝试在AppHarbor工作文件系统上永久存储数据是行不通的,因为每次部署都会擦除它们。 如果您已经拥有包含数据的LocalDB数据库,则应该能够使用SQL Server批量复制将其传输到AppHarbor。 You should switch to using sequelizer, the AppHarbor database-as-a-service add-on. Trying to permanently stor ...
-
您无法更改实时应用的屏幕截图,您需要创建新版本。 ( https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/ReplacingYourAppWithANewVersion.html ) 商店不允许正式使用网络应用程序。 确保您的新版本符合商店规则,特别是4.2。 ( https://developer.apple.com/app- ...
-
也许这就是你要找的东西: http : //www.webshotspro.com/ (它不是免费但很便宜) Maybe this will be what you are looking for: http://www.webshotspro.com/ (it's not free but quite cheap)
-
构建一个完整的Web服务,网站和iPhone应用程序(Architechting a complete web service, website, and iphone app)[2022-01-21]
是的,您将需要公开Web服务以便应用程序绑定/通信。 我建议该服务作为一个单独的站点运行(例如data.yourdomain.com,该站点将在yourdomain.com上运行),该站点也使用该站点的数据。 这样,您就可以为“终点”(站点和应用程序)共享相同的架构。 确保您的webservice在每次调用时都使用身份验证令牌(用户名/密码或oauth / etc),这有助于防止对服务/数据库进行任何未经授权的调用。 此外,通过有效的HTTPS连接(仅限https)公开您的服务将阻止嗅探数据以获取密码。 正 ... -
Windows 7(或更高版本)上的Web应用程序的自动安装程序(Automatic installer for a web app on Windows 7 (or higher))[2022-03-23]
如果您想要一个免费的解决方案, WiX就是您所需要的,但如果您从未使用它创建一个软件包,那么它将花费您一些时间来学习它。 一个更易于使用,功能强大但付费的工具是Advanced Installer ,您需要专业版,但您可以使用30天试用模式免费试用。 它具有SQL Server Express的预定义先决条件,内置支持以安装IIS实体以及设置文件/文件夹权限。 从根本上说,你需要的所有要求。 要启用任何IIS功能,只需添加PowerShell脚本即可。 If you want a free solution ... -
正如本文档中提到的Azure App Service中的安全级别: 基础架构和平台安全性 - 您相信Azure可以获得在云中实际安全运行所需的服务。 应用程序安全性 - 您需要安全地设计应用程序本身。 这包括您如何与Azure Active Directory集成,如何管理证书,以及如何确保您可以安全地与不同的服务进行通信。 对于基础架构和平台安全性,Azure将隔离您的App Service应用程序,并且敏感数据(例如,sql connectionstring,appId,appSecret等)的通信始终 ...
-
我假设您自己实现了移动应用程序和网站,需要检测自己的应用程序与浏览器。 我一直在为此练习不同的解决方案。 当应用程序在移动设备中运行时,您可以将javascript桥接对象插入到浏览器的上下文中。 当应用程序在浏览器中运行时,您检查是否存在javascript桥对象,如果不存在,则验证它是否存在。 所有你需要它有一个方法,两种情况如下: nativeBridge.getClientId(); 你将在网站上实现它: if( !window.nativeBridge ){ window.nativeB ...