说我有一个文本文件:
I love bananas.
<age> 23 </age> years old.
I like beaches.
Run Code Online (Sandbox Code Playgroud)
我想要做的就是打开所说的文件并将年龄改为24或25.任何方式在Java中都可以这样做而不读写整个文件?我知道它有可能与缓冲的读写器,但我正在寻找一个较少的内存密集的方式,当文件变得庞大.
当该部分已满时,此代码会抛出“组描述为空”。
Resources:
FormulationSG:
Type: 'AWS::EC2::SecurityGroup'
Properties:
Tags:
- Key: 'Name'
Value: 'FormulationSG'
VpcId: 'vpc-yyy00yyy'
GroupDescription: 'Port Rules for Formulation and on Port 11.'
SecurityGroupIngress:
- IpProtocol: tcp
CidrIp: 192.168.0.0/8
FromPort: '11'
ToPort: '11'
- IpProtocol: tcp
FromPort: '91'
ToPort: '91'
SourceSecurityGroupName: 'sg-1234567'
Run Code Online (Sandbox Code Playgroud)
忽略所有已更改的数字,但我遇到的问题是,一旦我尝试获取现有安全组“sg-1234567”,它就会给我一条错误消息,指出组描述已在引号中时无效。
yaml amazon-web-services aws-cloudformation aws-security-group